Guest User

Untitled

a guest
May 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. private _getListData(listName: string): Promise<ISPLists> {
  2.  
  3. const queryString: string = '$select=Title,ID,Created,Author/ID,Author/Title&$expand=Author/ID,Author/Title&$Orderby=SortOrder';
  4.  
  5. return this.context.spHttpClient
  6. .get(`${this.context.pageContext.web.absoluteUrl}/_api/web/lists/GetByTitle('${listName}')/items`,//?${queryString}`,
  7. SPHttpClient.configurations.v1)
  8. .then((response: SPHttpClientResponse) => {
  9. if (response.status === 404) {
  10. Log.error('js-display-List', new Error('List not found.'));
  11. return [];
  12. }else {
  13. return response.json();
  14. }
  15. });
  16. }
Add Comment
Please, Sign In to add comment