I need to check if a a folder exists in sharepoint : if it doesn't exists I need to create it
This is my call:
Await graphClient.Sites(MySiteId).Drive.Items(MyFolderId).Request.GetAsync
If my MyFolderIdexists it all works fine, but if it doesn't exists the call remains stuck indefinitely
In general I notice that each time I make a graph call, using GraphClient, that looks for something that doesn't exists in sharepoint I get stucked
By now, not to block my application, I'm using a timeout, checking if the result status is RanToCompletion . But I can never know whether my call has an error, a simple timeout or a not found exception:
Dim itemsInFolderRequest = graphClient.Sites(SharePointSiteID).Drive.Items(SharePointParentFolderId).Children.Request
Dim itemsInFolder = itemsInFolderRequest.GetAsync
Await Task.WhenAny(itemsInFolder, Task.Delay(m_GraphRquestTimeoutMs))
If itemsInFolder IsNot Nothing AndAlso itemsInFolder.Status = Threading.Tasks.TaskStatus.RanToCompletion Then
'only here I'm sure I can read results
else
'here I don't know what happened
End If
Is there a way to make the
Await graphClient.Sites(MySiteId).Drive.Items(MyFolderId).Request.GetAsync
work without blocking, returning me a simple "Not found"?