Skip to content

Commit 6feed2e

Browse files
Merge pull request SharePoint#7745 from juliemturner/master
Update to PnPjs documentation and samples
2 parents d7c01cd + f82ce35 commit 6feed2e

6 files changed

+263
-450
lines changed
-51.1 KB
Binary file not shown.
163 KB
Loading
-176 KB
Loading
-39.2 KB
Binary file not shown.

docs/spfx/connect-to-sharepoint.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Connect to SharePoint APIs
33
description: Different approaches of connecting to SharePoint APIs from your SharePoint Framework solutions
4-
ms.date: 12/04/2020
4+
ms.date: 02/24/2022
55
ms.prod: sharepoint
66
ms.localizationpriority: high
77
---
@@ -84,15 +84,13 @@ The SPHttpClient offers basic support for communicating with the SharePoint REST
8484

8585
## Connect to SharePoint using PnPjs
8686

87-
[PnPjs](https://pnp.github.io/pnpjs/) is an open-source JavaScript library for communicating with SharePoint and Office 365. It exposes a fluent API that allows you to easily consume SharePoint and Office 365 REST APIs in a type-safe way. To retrieve the title of the current site using PnPjs, you would execute the following code:
87+
[PnPjs](https://pnp.github.io/pnpjs/) is an open-source JavaScript library for communicating with SharePoint and Microsoft 365. It exposes a fluent API that allows you to easily consume SharePoint and Microsoft 365 REST APIs in a type-safe way. To retrieve the title of the current site using PnPjs, you would execute the following code:
8888

8989
```typescript
90-
sp.web
90+
const web = await sp.web
9191
.select('Title')
92-
.get<{Title: string;}>()
93-
.then(web => {
94-
console.log(web.Title);
95-
});
92+
.get<{Title: string;}>();
93+
console.log(web.Title);
9694
```
9795

9896
[!INCLUDE [pnp-js](../../includes/snippets/open-source/pnp-js.md)]
@@ -119,4 +117,4 @@ PnPjs is an additional dependency that you need to add to your project and manag
119117

120118
#### Additional payload
121119

122-
PnPjs offers a rich set of capabilities for communicating with SharePoint APIs. But these capabilities add extra load to your project. Compressed, PnPjs will add ~40 KB to the generated bundle size.
120+
PnPjs offers a rich set of capabilities for communicating with SharePoint APIs. The library supports selective imports so with carful curation the overall impact to your bundle size can be mitigated. For more information please see the documentation at [https://pnp.github.io/pnpjs/](https://pnp.github.io/pnpjs/).

0 commit comments

Comments
 (0)