Créer un site internet

Sharepoint Caml Query

fredericdietrich By On 08/09/2020

In SQL

Basic CSOM caml query

 

<View>
    <Query>
        <Where>
            <Eq>
                <FieldRef Name='Matricule'/>
                <Value Type='Text'>90136794</Value>
            </Eq>
        </Where>

<OrderBy><FieldRef Name='ID' Ascending='True'/></OrderBy>
    </Query>
    <ViewFields>
        <FieldRef Name='Matricule' />
        <FieldRef Name='Email' />
    </ViewFields>
    <RowLimit>2</RowLimit>
</View>

 

Query Null Text fields or not

<Where>
    <IsNotNull>
        <FieldRef Name="Famille"/>
    </IsNotNull>
</Where>


<Where>
    <IsNull>
        <FieldRef Name="Famille"/>
    </IsNull>
</Where>

 

by ID

<Where>
    <Eq>
        <FieldRef Name='ID'/>
        <Value Type='Counter'>645</Value>
    </Eq>
</Where>

 

Get tasks by itemId (relatedItems in tasks list)

<Where>
    <Eq>
        <FieldRef Name='RelatedItems'/>
        <Value Type='RelatedItems'>""ItemId"":435,</Value>
    </Eq>
</Where>

 

boolean / Yes/No

<Eq><FieldRef Name='YourFieldName'/><Value Type='Boolean'>1</Value></Eq>

 

Comparators

<Eq> => equals

<Neq> => not equals

<Lt> => Less than

<Leq> => less or equal

<Gt> greater than

<Geq> greater or equal

<Contains>

<BeginsWith>

 

Errors

  • Sharepoint error Error in my cases
    One or more field types are not installed properly. Go to the list settings page to delete these fields. Fields in your query are not in list

    Cannot complete this action.

    Please try again.

    Syntax error in your query
       
       
       
       
       
       
       

     

 

CSOM Sharepoint

  • No ratings yet - be the first to rate this.