0
votes

I'm trying to get a Site resource by path using the Rest Graph API as explained in the docs and I'm getting an error message indicating:

Provided identifier is malformed - site collection id is not valid

I'm able to access the SharePoint site through the browser accessing to this URL:

https://<tenant>.sharepoint.com/sites/<site name>

The endpoint I'm forming has the following shape:

https://graph.microsoft.com/v1.0/sites/<tenant>.sharepoint.com:/<site name>

I am able to successfully retrieve Site information by id but not by path. Here is a screenshot of how the request I'm trying to make looks like in Postman.

Postman GraphApi request

This is the response when getting site information by id:

enter image description here

Is the endpoint URL correctly formed for retrieving the site resource information?

2
Could you add the results you're getting from the site by id? The site name would also be helpful.Marc LaFleur
I've added the response I get by Id. Sorry, it is mostly covered, I can't disclose any detail about the client.sanfalero

2 Answers

1
votes

When addressing sites by path, the format as follows:

SharePoint hostname, followed by a colon and the relative path to the site

It appears in your example site name specified instead of relative site path:

https://graph.microsoft.com/v1.0/sites/<tenant>.sharepoint.com:/<site name>
                                                                ^^^^^^^^^^ 
                                                      should refer to relative path to the site

instead it should be like this:

https://graph.microsoft.com/v1.0/sites/<tenant>.sharepoint.com:/sites/<site name>
0
votes

Here i tested this endpoint and am able to get site resource.

Site URL:

https://{tenant}.sharepoint.com/sites/{sitename}

Get a site resource by path:

https://graph.microsoft.com/v1.0/sites/{tenant}.sharepoint.com:/sites/{sitename}

result: call endpoint through MS graph explorer

thanks