-
-
Save naveenmaurya/5a58e5516c0fa87ee6841282c48f413f to your computer and use it in GitHub Desktop.
Get count of items/files in list/document library in SharePoint Online with SPFx
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
import { SPHttpClient, SPHttpClientResponse, SPHttpClientConfiguration } from '@microsoft/sp-http'; | |
this.context.spHttpClient.get(`${this.context.pageContext.web.absoluteUrl}/_api/web/AppTiles`, SPHttpClient.configurations.v1) | |
.then((response: SPHttpClientResponse) => { | |
response.json() | |
.then((responseJSON: any) => { | |
console.log(responseJSON); // Gets all the list and document library details in JSON | |
}) | |
.catch(error => { | |
console.log(error); | |
}); | |
}) | |
.catch(error => { | |
console.log(error); | |
}); | |
// this.context refers to WebPartContext in the BaseClientSideWebPart class. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment