Last active
September 18, 2024 03:30
Revisions
-
alirobe revised this gist
Sep 18, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ var listUrl = "https://<TENANT>.sharepoint.com/sites/site/_api/<SITE>/lists/getByTitle('<LIST>')" var url = `${listUrl}/items?$top=5000`; var fetchOptions = { headers: { "Accept": "application/json;odata=nometadata" } }; var response = await fetch(url, fetchOptions); -
alirobe renamed this gist
Sep 18, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
alirobe created this gist
Sep 18, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ var listUrl = "https://tenant.sharepoint.com/sites/site/_api/web/lists/getByTitle('List Name')" var url = `${listUrl}/items?$top=5000`; var fetchOptions = { headers: { "Accept": "application/json;odata=nometadata" } }; var response = await fetch(url, fetchOptions); var data = await response.json(); var items = data.value; var commentsPromises = items.map(async item => { var commentsUrl = `${listUrl}/items(${item.Id})/Comments()`; var commentsResponse = await fetch(commentsUrl, fetchOptions); if (commentsResponse.ok) { var commentsData = await commentsResponse.json(); item.Comments = commentsData.value; } else { item.Comments = []; } }); await Promise.all(commentsPromises); console.log(items);