
Hi @Sezgin Tabak ,
I see that you're trying to fetch a large list. As @Deva-MSFT suggested, you may need to use pagination, or you may receive list view threshold error.
If you're using MS Graph Service Client (C#), please take a reference of the below tutorial:
demo1:
List<ListItem> Allitems = new List<ListItem>();
var items = await graphClient.Sites["abc.sharepoint.com,5ae427d1-c859-4c58-97c4-e20ad27b850b,352d1542-3d0a-4f99-a529-723e41552082"]
.Lists["40418c29-06c3-442e-9d01-972d4e9f0129"]
.Items
.Request()
.Top(100)
.GetAsync();
var i = 1;
var pageIterator = PageIterator<ListItem>
.CreatePageIterator(graphClient, items, (e) =>
{
Console.WriteLine($"{i++} {e.WebUrl}");
Allitems.Add(e);
return true;
});
await pageIterator.IterateAsync();
demo2:
var totalitems = new List<Microsoft.Graph.ListItem>();
var items = graphClient
.Sites["abc.sharepoint.com,5ae427d1-c859-4c58-97c4-e20ad27b850b,352d1542-3d0a-4f99-a529-723e41552082"]
.Lists["40418c29-06c3-442e-9d01-972d4e9f0129"].Items
.Request()
.GetAsync().Result;
totalitems.AddRange(items.CurrentPage);
while (items.NextPageRequest != null)
{
items = items.NextPageRequest.GetAsync().Result;
totalitems.AddRange(items.CurrentPage);
}
Console.WriteLine(totalitems);
Pagination using CSOM:
More references:
- https://natechamberlain.com/2018/05/21/how-to-resolve-sharepoint-list-view-threshold-error-the-view-cannot-be-displayed-because-it-exceeds-the-list-view-threshold/
- https://support.microsoft.com/en-us/office/manage-large-lists-and-libraries-b8588dae-9387-48c2-9248-c24122f07c59?ui=en-US&rs=en-US&ad=US
Best Regards,
Baker Kong
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.