microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

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

Open
#1,880 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug: documentation
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Graph Explorer C# snippet generator for the /sites/{hostname}:/{server-relative-path} request and compare it with the site-ID example shown in the issue. Done means the generated snippet uses contoso.sharepoint.com:/sites/marketing for this request and the documentation includes a host-and-path example.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.