Skip to content

Commit

Permalink
Merge pull request #2753 from tavikukko/version-3
Browse files Browse the repository at this point in the history
Fix docs for AssignFrom usage in calling other endpoint guidance
  • Loading branch information
juliemturner authored Aug 6, 2023
2 parents ec55b4c + 14c707e commit 8f00cf2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/concepts/calling-other-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ The second method essentially starts from scratch where the user constructs the

```TypeScript
import { spfi } from "@pnp/sp";
import { AssignFrom } from "@pnp/core";
import "@pnp/sp/webs";
import "@pnp/sp/lists";
import { spGet, SPQueryable, SPFx, AssignFrom } from "@pnp/sp";
import { spGet, SPQueryable, SPFx } from "@pnp/sp";

// Establish SPFI instance passing in the appropriate behavior to register the initial observers.
const sp = spfi(...);
Expand All @@ -49,7 +50,7 @@ const spQueryable = SPQueryable("https://contoso.sharepoint.com/sites/testsite/_
// ***or***

// For v3 the full url is require for SPQuerable when providing just a string
const spQueryable = SPQueryable("https://contoso.sharepoint.com/sites/testsite/_api/web/lists/getByTitle('My List')/items(1)").using(AssignFrom(sp));
const spQueryable = SPQueryable("https://contoso.sharepoint.com/sites/testsite/_api/web/lists/getByTitle('My List')/items(1)").using(AssignFrom(sp.web));

// and then use spQueryable to make the request
const item: any = await spGet(spQueryable);
Expand Down

0 comments on commit 8f00cf2

Please sign in to comment.