0
votes

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://docs.microsoft.com/en-us/graph/api/resources/drive?view=graph-rest-1.0

This is the documentation for the DriveItem object: https://docs.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0

This is the documentation for the SharepointIds object: https://docs.microsoft.com/en-us/graph/api/resources/sharepointids?view=graph-rest-1.0

1

1 Answers

2
votes

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();