6

I get timeout error frequently with the below code using the Microsoft.Graph package,

await graphServiceClient.Users[UserId].Contacts.Request().AddAsync(contact);

As there are no option (that I could find) for adding multiple contacts at a time, I was calling the above LOC parallel. I have around say 500 contacts to import and many of them fails giving the timeout response

Exception: Code: timeout Message: The request timed out.

Are there any option to set TimeOut to a higher value in Microsoft.Graph GraphServiceClient?

rkeeth
  • 109
  • 1
  • 9
  • How many are you attempting to send in parallel? – Marc LaFleur Apr 06 '17 at 23:25
  • I have the same exception in similar situation. I'm doing parallel request for file information from `Microsoft.Graph` and when cancel it with `CancellationToken`, I receive this exception. MsGraph version 1.7.0 – 23W Dec 19 '17 at 15:10

1 Answers1

18

You can set the Timeout to a higher value like this: For example to set the Timeout to one hour:

graphServiceClient.HttpProvider.OverallTimeout = TimeSpan.FromHours(1);
Jeremy
  • 318
  • 4
  • 16