Converting ListItemCollection to DataTable in Client side object model for SP Online

Dewadatta Avasare 0 Reputation points
2022-01-11T04:03:50.483+00:00

Is there any way to convert ListItemCollection to a datatable like we could do in Sharepoint server side code using
SPListItemCollection listcol= listname.GetItems(query);
DataTable datatableOne= new DataTable();
if (listcol!= null && listcol.Count > 0)
{
datatableOne= listcol.GetDataTable();
}
Is there any GetDataTable method for CSOM because I am unable to find one in documentation for SP Online.
Help would be much appreciated.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,671 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,673 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 31,376 Reputation points Microsoft Vendor
    2022-01-11T08:08:13.517+00:00

    Hi anonymous user ,
    There is no similar method in CSOM (C#). You have to build manually as like following code.
    163824-test.txt

    You can check the methods of ListItemCollection from the document


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.