在 Microsoft.Graph SDK 中将 TimeOut 设置为更高的值

Set TimeOut to a higher value in Microsoft.Graph SDK

我使用 Microsoft.Graph 包在下面的代码中经常遇到超时错误,

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

由于没有(我能找到的)一次添加多个联系人的选项,我调用了上面的 LOC parallel。我大约有 500 个联系人要导入,其中很多都没有给出超时响应

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

在 Microsoft.Graph GraphServiceClient 中是否有任何选项可以将 TimeOut 设置为更高的值?

您可以像这样将超时设置为更高的值: 例如,将超时设置为一小时:

graphServiceClient.HttpProvider.OverallTimeout = TimeSpan.FromHours(1);