我很难使用 ClientCredential 身份验证流程制作应用程序以在 SharePoint 列表上创建订阅。
要求:
var subscription = new Subscription
{
ChangeType = "updated",
NotificationUrl = "{validNotificationUrl}",
Resource = "sites/root/lists/{listId}",
ExpirationDateTime = DateTime.UtcNow.AddDays(2),
ClientState = "{clientState}"
};
subscription = await _graphClient.Subscriptions.Request().AddAsync(subscription);
回应:
Unauthorized 403
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: Forbidden; Reason: Access denied. You do not have permission to perform this action or access this resource.]",
"innerError": {
"date": "2020-08-04T13:01:27",
"request-id": "c480fa5d-4bbd-44a1-9f86-587548a29a19"
}
}
我检查了请求 access_token,它具有所需的权限(根据文档,Sites.ReadWrite.All、Sites.Manage.All应该足够了)。阅读订阅和创建列表适用于应用程序。
我开始尝试不同的配置,试图找出问题所在,并设法:
- 使应用程序在用户资源上创建订阅。
- 使委派用户在列表上创建订阅
我感到很失落,因为我给应用程序比委派用户更多的权限,它仍然得到未经授权的 403,响应错误并不能说明如何解决这个问题。
是否有任何 SharePoint 列表订阅配置需要仅针对应用身份验证进行处理?