Reputation: 107
I'm trying to get items from SharePoint using the Graph API in the name of the user, all these done inside a .net core 3.1 web app using oauth. When I request for specific items in a SharePoint document library I get the following ServiceException:
ex = {"Code: itemNotFound\r\nMessage: The resource could not be found.\r\nInner error:\r\n\tAdditionalData:\r\n\trequest-id: 7605d475-5967-481e-a16c-ab1fad610ef9\r\n\tdate: 2020-04-15T21:27:48\r\nClientRequestId: 7605d475-5967-481e-a16c-ab1fad610ef9\r\n"}
My calling function is the following:
var searchResult = await graphServiceClient
.Sites[$"{SharePointSiteId}"]
.Drives[$"{SharePointDocumentLibraryId}"]
.Items[$"{InvoicesFolderId}"]
.Children
.Request()
.GetAsync();
where:
The strange is that until I request for the Drive only:
var searchResult = await graphServiceClient
.Sites[$"{SharePointSiteId}"]
.Drives[$"{SharePointDocumentLibraryId}"]
.Request()
.GetAsync();
everything goes fine.
Strange thing 2: If I call the API using the Graph explorer with the same user in the same time using the Item identifier {InvoicesFolderId}, it gives back its children well. Needless to say, the user can login to the SPS site and do whatever she wants. :)
Upvotes: 0
Views: 178
Reputation: 226
I am able to reproduce the same exception thrown when calling from Graph .Net SDK in C#. Taking the exact same URL that is generated by SDK and testing in Graph Explorer is successful as well. I would recommend opening an issue on the Graph .Net SDK repo.
Upvotes: 1