Reputation: 901
Using the Graph API NuGet package, how do I populate the SharePointIds property.
Consider the following code snippet:
public async Task<Drive> RetrieveOneDriveForUserAsync(string userId)
{
return await _graphClient.Users[userId].Drive.Request().GetAsync();
}
The "SharepointIds" property is always NULL
EDIT:
NOTE: This is NOT for personal OneDrive items. This is for Group OneDrive items.
This is the documentation for the Drive object: https://learn.microsoft.com/en-us/graph/api/resources/drive?view=graph-rest-1.0
This is the documentation for the DriveItem object: https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0
This is the documentation for the SharepointIds object: https://learn.microsoft.com/en-us/graph/api/resources/sharepointids?view=graph-rest-1.0
Upvotes: 0
Views: 975
Reputation: 627
The SharePointIds object applies to an item stored in a SharePoint Site.
_graphClient.Users[userId].Drive.Items[itemId].Request().Select("sharepointids").GetAsync();
(Folders are an item, so you can get the Ids for Root.)
_graphClient.Users[userId].Drive.Root.Request().Select("sharepointids").GetAsync();
Upvotes: 2