我已设置user.read, calendars.readwrite
许可,并且可以成功进行身份验证。但是我得到了:
Microsoft.Graph.ServiceException : Code: ErrorInvalidRequest
Message: The OData request is not supported.
我的测试看起来像
var graphClient = new GraphServiceClient(new DelegateAuthenticationProvider(request => {
request.Headers.Authorization = new AuthenticationHeaderValue("bearer", _authenticationResult.AccessToken);
return Task.FromResult(0);
}));
var user = await graphClient.Me.Request().GetAsync();
Console.WriteLine(user.Id + ": " + user.DisplayName + " <" + user.Mail + ">");
await graphClient.Me.Calendar.Request().CreateAsync(new Calendar(){Name = "test"});
答案 0 :(得分:1)
实际上是
await graphClient.Me.Calendars.Request().AddAsync(new Calendar(){Name = "test"});
而不是
graphClient.Me.Calendar
答案 1 :(得分:-1)
尝试一下:
await graphClient.Me.Calendar.Request().AddAsync(new Calendar(){Name = "test"});