0
我的代碼...通用Windows應用程序(UWP)的Office 365 API - 讀取日曆事件使用REST API
HttpClient client = new HttpClient();
var token = await AuthenticationHelper.GetTokenForUserAsync();
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
HttpResponseMessage response = await client.GetAsync(new Uri("https://graph.microsoft.com/v1.0/me/events"));
if (!response.IsSuccessStatusCode)
{
throw new Exception(response.StatusCode.ToString());
}
我已經使用這個文件 https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/user_list_events
這github上示例 https://github.com/microsoftgraph/uwp-csharp-connect-rest-sample
我得到這個錯誤..
{StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
client-request-id: 0de835e0-91d0-444d-bddc-a00b0d270eeb
Server: Microsoft-IIS/8.5
request-id: 0de835e0-91d0-444d-bddc-a00b0d270eeb
Transfer-Encoding: chunked
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"South India","Slice":"SliceA","ScaleUnit":"002","Host":"AGSFE_IN_2","ADSiteName":"MAA"}}
Duration: 1047.8402
Cache-Control: private
Date: Mon, 26 Sep 2016 06:55:15 GMT
X-Powered-By: ASP.NET
Content-Type: application/json
}}