question

05982987 avatar image
0 Votes"
05982987 asked 05982987 commented

Microsoft Graph v1.0 getSchedule api is slow

I am referencing the Microsoft Docs https://docs.microsoft.com/en-us/graph/api/calendar-getschedule?view=graph-rest-1.0&tabs=http

I'm trying to send a request to https://graph.microsoft.com/v1.0/me/calendar/getSchedule.
I get a successful response but sometimes the API is very slow, especially on the initial page load where it can take more than 10 seconds. When I send the request again, however, it only takes 0.3 seconds.

Below is my send request code


 System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

 WebRequest request = WebRequest.Create(
     " https://graph.microsoft.com/v1.0/me/calendar/getSchedule ");

 string param = "{\"schedules\":[\"" + userPrincipalName + "\"],";
 param += "\"startTime\" : {\"dateTime\": \"" + startTime
     + "\",\"timeZone\": \"Taipei Standard Time\"},";
 param += "\"endTime\" : {\"dateTime\": \"" + endTime 
     + "\",\"timeZone\": \"Taipei Standard Time\"},";
 param += "\"availabilityViewInterval\" : 60}";

 request.Method = "POST";
 request.ContentType = "application/json";
 request.Headers["Authorization"] = " Bearer " + token;
 request.Headers["Prefer"] = "outlook.timezone=\"Taipei Standard Time\"";

 using (var streamWriter = new StreamWriter(request.GetRequestStream()))
 {
     streamWriter.Write(param);
 }

 try
 {
     var httpResponse = (HttpWebResponse)request.GetResponse();
     using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
     {
         var result = streamReader.ReadToEnd();
         WebUtility.WriteAjaxResult(true, null, result);

     }
 }

I hope someone can answer the reason for me, thanks!

microsoft-graph-calendar
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @05982987 are you able to reproduce this in postman or graph explorer?

0 Votes 0 ·

yes i can able to reproduce this,below is response result

90281-azurereturn.png
90189-azureshow.png


0 Votes 0 ·
azurereturn.png (39.5 KiB)
azureshow.png (12.6 KiB)

0 Answers