forked from pnp/pnpjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvements to graph.sites, updates to docs, addresses pnp#2083
- Loading branch information
1 parent
5ce8b78
commit 730feb0
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# @pnp/graph/sites | ||
|
||
The search module allows you to access the Microsoft Graph Sites API. | ||
|
||
[](../concepts/selective-imports.md) | ||
|
||
## Call graph.sites | ||
|
||
```TypeScript | ||
import { graphfi, SPFx } from "@pnp/graph"; | ||
import "@pnp/graph/sites"; | ||
|
||
const graph = graphfi().using(SPFx(this.context)); | ||
|
||
const sitesInfo = await graph.sites(); | ||
``` | ||
|
||
## Call graph.sites.getById | ||
|
||
```TypeScript | ||
import { graphfi, SPFx } from "@pnp/graph"; | ||
import "@pnp/graph/sites"; | ||
|
||
const graph = graphfi().using(SPFx(this.context)); | ||
|
||
const siteInfo = await graph.sites.getById("{site identifier}")(); | ||
``` | ||
|
||
## Make additional calls | ||
|
||
We don't currently implement all of the available options in graph for sites, rather focusing on the sp library. While we do accept PRs to add functionality, you can also make calls by path: | ||
|
||
### Get lists | ||
|
||
```TypeScript | ||
import { Site } from "@pnp/graph/sites"; | ||
|
||
const sites = graph.sites.getById("{site id}"); | ||
|
||
const listsInfo = await Site(sites, "lists")(); | ||
``` | ||
|
||
### Get list | ||
|
||
```TypeScript | ||
import { Site } from "@pnp/graph/sites"; | ||
|
||
const sites = graph.sites.getById("{site id}"); | ||
|
||
const listInfo = await Site(sites, "lists/{listid}")(); | ||
``` | ||
|
||
### Get list items | ||
|
||
```TypeScript | ||
import { Site } from "@pnp/graph/sites"; | ||
|
||
const sites = graph.sites.getById("{site id}"); | ||
|
||
const users = await Site(sites, "lists/{listid}/items")(); | ||
``` | ||
|
||
### Get File/Item version information | ||
|
||
```TypeScript | ||
import { Site } from "@pnp/graph/sites"; | ||
|
||
const sites = graph.sites.getById("{site id}"); | ||
|
||
const users = await Site(sites, "lists/{listid}/items/{item id}/versions")(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters