msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

the Graph explorer CSharp code snippet for getting a site by host and path is wrong

Open Ofer-Gal opened this issue 1 year ago • 0 comments

Describe the bug In Graph explorer, The snippet for

https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/marketing

is

var graphClient = new GraphServiceClient(requestAdapter);
var result = await graphClient.Sites["{site-id}"].Sites["{site-id1}"].GetAsync();

It should be

var graphClient = new GraphServiceClient(requestAdapter);
var result = await graphClient.Sites["contoso.sharepoint.com:/sites/marketing"].GetAsync();

Like in the http request

It would be nice the docs would show an example of getting a site by host and path for C# not only by site ID which in most cases is unknown while coding.

Thank you

Ofer-Gal avatar May 06 '23 08:05 Ofer-Gal