我正在尝试构建一个 spfx web 部件,在同一上下文中更新列表,\n该按钮触发一个函数,该函数从上下文中获取当前用户名和日期,构建一个 json,然后将其字符串化,然后构建一个图形请求并将其与一个事件放在一起onclick。
我收到以下错误:
\n\n\n类型“Promise”不可分配给类型\n“MouseEventHandler”。类型 'Promise'\n 与签名 '(event:\nMouseEvent<HTMLButtonElement, MouseEvent>): void'.ts(2322)\nindex.d.ts(1449, 9): 预期类型来自属性 ' 不匹配onClick'\n这是在类型上声明的\n'DetailedHTMLProps<ButtonHTMLAttributes
\n
签名WP.tsx:
\nimport * as React from 'react';\nimport * as strings from 'SignatureWpWebPartStrings';\nimport styles from './SignatureWp.module.scss';\nimport { ISignatureWpProps, ISignatureWpState, SharepointListItem} from './ISignatureWpProps';\nimport { escape } from '@microsoft/sp-lodash-subset';\nimport { Checkbox } from 'office-ui-fabric-react';\nimport { ServiceKey, ServiceScope } from "@microsoft/sp-core-library";\nimport { PageContext } from "@microsoft/sp-page-context";\nimport * as moment from 'moment';\nimport { WebPartContext } from "@microsoft/sp-webpart-base";\nimport { ClientMode } from …Run Code Online (Sandbox Code Playgroud) 我的WPF应用程序突然失败,出现以下异常:
System.IO.FileFormatException:在FontFamilyCollection中找不到与当前操作系统或更高版本匹配的FontFamily元素:Windows7SP1
我尝试过不同的操作系统,但它只发生在带有SP1的Windows 7上.
使用 Graph API 创建订阅时,即使我们在访问令牌中有足够的权限,也会收到以下错误。
令牌权限:Calendars.ReadWrite Contacts.ReadWrite Tasks.ReadWrite User.Read profile openid email
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: Forbidden; Reason: Access is denied to the requested resource. The user might not have enough permission.]",
"innerError": {
"date": "2022-11-30T08:23:03",
"request-id": "0541655d-83f3-456e-af47-165caf259c76",
"client-request-id": "0541655d-83f3-456e-af47-165caf259c76"
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用的详细信息:
请求网址:
POST https://graph.microsoft.com/v1.0/subscriptions
Run Code Online (Sandbox Code Playgroud)
请求正文:
{
"notificationUrl":"<development-url>/notifications/office365/graph/v1",
"expirationDateTime":"2022-12-03T06:48:06Z",
"resource":"/me/todo/lists/{taskListId}/tasks",
"changeType":"created,updated,deleted",
"clientState":"<client-state>"
}
Run Code Online (Sandbox Code Playgroud)
使用的 API - https://graph.microsoft.com/v1.0/subscriptions(微软文档)
问题影响的用户数 - 190
azure microsoft-graph-sdks microsoft-todo microsoft-graph-api
我想在我的应用程序中使用两个不同的记录器,这样我就能够将不同的消息记录到不同的文件中。我的 app.config 看起来像
<log4net>
<appender name="Appender1" type="log4net.Appender.RollingFileAppender">
<file value="File1" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1MB" />
<rollingStyle value="Composite" />
<staticLogFileName value="false" />
<datePattern value=".yyyy-MM-dd'.txt'" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message %exception{Message} %newline" />
<IgnoresException value="False" />
</layout>
</appender>
<appender name="Appender2" type="log4net.Appender.RollingFileAppender">
<file value="File2.Log"/>
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<maxSizeRollBackups value="100" />
<maximumFileSize value="10MB" />
<rollingStyle value="Size" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %message %newline" />
<IgnoresException value="True" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Microsoft.Practices.ServiceLocation.ServiceLocator和MEF.接口IServiceLocator使用两个参数定义方法GetInstance.第一个参数是serviceType,第二个参数是关键.
我有两个实现接口IMyInterface的类,它们具有Export属性:[Export(typeof(IMyInterface)), PartCreationPolicy(CreationPolicy.Shared)]
public class Class1 : IMyInterface
{}
[Export(typeof(IMyInterface)), PartCreationPolicy(CreationPolicy.Shared)]
public class Class2: IMyInterface
{}
Run Code Online (Sandbox Code Playgroud)
我想通过Prism ServiceLocator GetInstance方法获取Class1的实例:
ServiceLocator.Current.GetInstance(typeof(IMyInterface),"Key");
Run Code Online (Sandbox Code Playgroud)
但我不知道应该如何定义"关键".我试图在export属性中定义键:
[Export("Key1",typeof(IMyInterface)), PartCreationPolicy(CreationPolicy.Shared)]
public class Class1 : IMyInterface
{}
[Export("Key2",typeof(IMyInterface)), PartCreationPolicy(CreationPolicy.Shared)]
public class Class2: IMyInterface
{}
Run Code Online (Sandbox Code Playgroud)
当我用关键参数调用方法GetInstance时
ServiceLocator.Current.GetInstance(typeof(IMyInterface),"Key1");
Run Code Online (Sandbox Code Playgroud)
我得到Microsoft.Practices.ServiceLocation.ActivationException(尝试获取IMyInterface类型的实例,键"Key1"时发生激活错误).有人知道如何定义导出键吗?谢谢
我试图在 postgresql sql 脚本中声明默认值 0 的整数变量:
DECLARE user_id integer;
Run Code Online (Sandbox Code Playgroud)
但它返回异常:
错误:“整数”处或附近的语法错误
我不确定如何声明一个变量,然后在 while 循环内使用该变量。
我有一个已签名的 USB 驱动程序。我也有出版商提供的证书。如果我尝试安装驱动程序pnputil
pnputil /add-driver CerttName.cer /install
Run Code Online (Sandbox Code Playgroud)
系统询问我是否要将发布者添加到受信任的发布者。
为了避免它,我尝试以编程方式将证书添加到 Trusted Publishers
string file = @"C:\Certificates\CertName.cer";
X509Store store = new X509Store(StoreName.TrustedPublisher, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadWrite);
store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(file)));
store.Close();
Run Code Online (Sandbox Code Playgroud)
证书已添加,但仍提示我pnputil将发布者添加到受信任的发布者。
如果我使用 certutil
certutil -addstore "TrustedPublisher" CertName.cer
Run Code Online (Sandbox Code Playgroud)
那么我不会被提示pnputil。
我还尝试从 certmgr.msc 手动导入证书,但它也不起作用。
我不明白为什么只certutil工作而其他方式(特别是 X509Store)不行。