很抱歉有多个帖子,我无法向 Microsoft Graph 发送帖子请求以使其正常工作,我正在关注此文档,我正在尝试在https://graph.microsoft.com/beta/myDomain/users/myEmail/calendar/events我有一个函数和一些帮助类来创建 json 对象,如下所示:List<ToOutlookCalendar> toOutlook = new List<ToOutlookCalendar>(); toOutlook.Add(new ToOutlookCalendar { Start = new End { DateTime = DateTimeOffset.UtcNow, TimeZone = "Pacific Standard Time" }, End = new End { DateTime = DateTimeOffset.UtcNow, TimeZone = "Pacific Standard Time" }, Body = new Body { ContentType = "HTML", Content = "testar for att se skit" }, Subject = "testin", Attendees = new List<Attendee> { new Attendee { EmailAddress = new EmailAddress { Address = "myEmail", Name = "name" }, Type = "Required" } }, Token = tokenn }); return new JsonResult { Data = toOutlook };以前我发帖到:https : //outlook.office.com/api/v2.0/myDomain/users/myEmail/calendar/events这给了我一个错误 401,抱怨令牌到星期。我创建了一个 x509 证书,但没有找到将它上传到我的 azure 目录的方法,因为我想以编程方式完成所有工作并且到目前为止已经成功并决定采用另一种方法并再次找到 Microsoft 图形文档。在授权 Calendars.ReadWrite 的应用程序权限后,我获取我的日历事件:https://graph.microsoft.com/beta/myDomain/users/myEmail/calendar/events。无论如何,我的请求看起来像这样,并给了我一个 400 Bad Request:htttpclient.DefaultRequestHeaders.Add("Authorization", "Bearer " + tokenn);htttpclient.DefaultRequestHeaders.Add("Host", "graph.microsoft.com");htttpclient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(res));
1 回答
- 1 回答
- 0 关注
- 158 浏览
添加回答
举报
0/150
提交
取消