none
SharePoint CSOM Get Items without CAML RRS feed

  • Question

  • In Sever Side code we can get ListItems Collection with SPList.Items without any CAML.

    However in Csom, I have not found any method equals with Server Side code, if it possible ? Or do I still need to specify CAML ?

    Thursday, October 10, 2019 4:26 AM

Answers

  • Hi zimi,

    Microsoft.SharePoint.Client.List class not provide Items property which is the same as Sever Side code.

    It's still necessary to use List.GetItems(CamlQuery) to return the items collection:

    List.GetItems method

    If you are not familiar with Caml Query, never mind, you can use CAML Designer to build the Query easily:

    https://www.biwug.be/resources

    And here is the demo to get list items with CAML Query in CSOM code:

    CAML QUERY to retrieve the items from a list using CSOM

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by zimi ta Thursday, October 10, 2019 9:15 AM
    Thursday, October 10, 2019 8:00 AM

All replies

  • Hi zimi,

    Microsoft.SharePoint.Client.List class not provide Items property which is the same as Sever Side code.

    It's still necessary to use List.GetItems(CamlQuery) to return the items collection:

    List.GetItems method

    If you are not familiar with Caml Query, never mind, you can use CAML Designer to build the Query easily:

    https://www.biwug.be/resources

    And here is the demo to get list items with CAML Query in CSOM code:

    CAML QUERY to retrieve the items from a list using CSOM

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by zimi ta Thursday, October 10, 2019 9:15 AM
    Thursday, October 10, 2019 8:00 AM
  • Hi Jerry,

    Thanks for help, your suggestion is helpful to me

    Thursday, October 10, 2019 9:15 AM