Reputation: 2155
I'm trying to retrieve a document from our SharePoint document center using the Microsoft Graph. I'm able to reach our base SharePoint site, but can't seem to drill down to the document center.
Our document center url is <sharepoint_host>/sites/DocumentCenter
. I want to be able to view and upload files under <sharepoint_host>/sites/DocumentCenter/Prospects
.
Tried a combination of things to see if I can reach the DocumentCenter, for example:
graphServiceClient
.Sites["<sharepoint_host>"]
.SiteWithPath("DocumentCenter")
.Request().GetAsync()
but again can't seem to reach it. Using the Microsoft Graph SDK for .NET.
Upvotes: 3
Views: 249
Reputation: 59358
Assuming /sites/DocumentCenter
corresponds to tenant site collection and Prospects
to list/library, Site
resource could be retrieved by server-relative URL path like this:
GET https://graph.microsoft.com/v1.0/sites/{tenant}.sharepoint.com:/sites/DocumentCenter
Refer docs on how to address a site resource by path
To retrieve List
resource the following endpoint could be utilized:
GET https://graph.microsoft.com/v1.0/sites/{tenant}.sharepoint.com:/sites/DocumentCenter:/lists/Prospects
Example
var site = await graphClient.Sites["contoso.sharepoint.com"].SiteWithPath("/sites/DocumentCenter").Request().GetAsync();
Console.WriteLine(site.Name);
Upvotes: 4