user1112324
user1112324

Reputation: 643

Cannot enumerate sites

Using the Microsoft Graph Dot Net package, Im unable to call:

await client.Sites.Request().GetAsync();

Even though on the graph explorer I can hit the sites endpoint fine:

enter image description here

Upvotes: 2

Views: 3065

Answers (1)

Dmitry Pimenov
Dmitry Pimenov

Reputation: 739

sites is a collection, and can be passed an identifier to get a single site resource. In your case, you are fetching child sites of the root site.

In the REST API, this is represented as ~/v1.0/sites/root/sites.

In the .NET SDK, you will write this as:

var sites = graphClient.Sites["Root"].Sites.Request().GetAsync();

Hope this helps.

Upvotes: 6

Related Questions