我想从其他日历更新MailboxSettings。
如何构建可以通过Microsoft Graph更新MailboxSetting的请求?
这是我的代码示例,但例外:
代码示例:
User obj = GraphServiceClient.Users[roomCalendarId].Request().Select("MailboxSettings").GetAsync().Result;
WorkingHours mailboxSettingsWorkingHours = obj.MailboxSettings.WorkingHours;
TimeOfDay tOd = new TimeOfDay(start.Hour, start.Minute, start.Second);
mailboxSettingsWorkingHours.StartTime = tOd;
TimeOfDay tOdE = new TimeOfDay(end.Hour, end.Minute, end.Second);
mailboxSettingsWorkingHours.EndTime = tOdE;
GraphServiceClient.Users[roomCalendarId].Request().Select("MailboxSettings").UpdateAsync(obj).Wait();
通过Micrsoft图,我从特定的日历中获取MailboxSettings,但是当我想更新MailboxSetting时,我得到了错误消息
“受保护的实体集当前不支持该请求”。
答案 0 :(得分:0)
SDK当前不支持此功能。您将需要进行明确的http调用以实现此目的。
以下是通过邮箱设置更新时区的代码:
Uri Uri = new Uri("https://graph.microsoft.com/v1.0/users/"+ user.Id
+"/mailboxSettings");
String jsonContent = "{\"timeZone\" : \""+ timezone +"\"}";
HttpContent httpContent = new StringContent(jsonContent, System.Text.Encoding.UTF8, "application/json");
await _httpClient.PatchAsync(Uri, httpContent);
您可以使用http://restsharp.org/轻松拨打http。