【发布时间】:2021-03-25 20:47:46
【问题描述】:
我正在尝试创建一个批处理请求,该请求将在单个请求中创建多个图形通知订阅。
我一直在阅读这篇文章: https://docs.microsoft.com/en-us/graph/sdks/batch-requests?tabs=csharp
问题
我收到以下错误消息,但我不知道如何解决:
(local variable) Task<Subscription> userRequest
Argument 1: cannot convert from 'System.Threading.Tasks.Task<Microsoft.Graph.Subscription>' to 'Microsoft.Graph.BatchRequestStep'
代码
var batchRequestContent = new BatchRequestContent();
GraphServiceClient graphClient = await GenerateGraphAuthToken(this.amParms);
foreach (string userId in this.UserstoSubscribe)
{
var subscription = new Subscription
{
ChangeType = "updated",
NotificationUrl= notificationURL,
Resource = $"users/{userId}/drive/root",
ExpirationDateTime = DateTimeOffset.Parse(subscriptionDate),
ClientState = "secretClientValue",
LatestSupportedTlsVersion = "v1_2"
};
var userRequest = graphClient.Subscriptions
.Request()
.AddAsync(subscription);
var userRequestId = batchRequestContent.AddBatchRequestStep(userRequest);
}
var returnedResponse = await graphClient.Batch.Request().PostAsync(batchRequestContent);
任何提示将不胜感激。对不起。我只是 .NET 和 MS Graph 的新手。
【问题讨论】:
标签: c# asp.net microsoft-graph-api