Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set TimeOut in Microsoft.Graph SDK Version 5

On graph sdk v4, I use option to set TimeOut to a higher value in Microsoft.Graph GraphServiceClient like bellow.

graphServiceClient.HttpProvider.OverallTimeout = TimeSpan.FromSeconds(10);

However, updating to graph sdk v5, I notice this doesn't supported in our new graph sdk v5. How can I do this in the new graph version? Anyone please help me

like image 369
John Park Avatar asked Sep 04 '26 00:09

John Park


1 Answers

Use GraphClientFactory to create a default HttpClient used by SDK and change Timeout.

Then pass the instance of HttpClient to the ctor of GraphServiceClient

var httpClient = GraphClientFactory.Create();
httpClient.Timeout = TimeSpan.FromMinutes(5);
var graphServiceClient = new GraphServiceClient(httpClient, tokenCredential);
like image 181
user2250152 Avatar answered Sep 05 '26 14:09

user2250152