none
Help : SharePoint (SOAP) GetListItems <--> query RRS feed

  • Question

  • Bonjour,

    Je suis débutant en Query sur SharePoint.

    Je souhaite envoyer la requête soap suivante "getlistItem":

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
       <soap:Header/>
       <soap:Body>
          <soap1:GetListItems>
             <!--Optional:-->
             <soap1:listName>{945BD61B-E7D0-4521-8051-07CE01FB1A92}</soap1:listName>
             <!--Optional:-->
             <soap1:viewName>{22636FB4-70C0-409E-9940-68E630E2C5B7}</soap1:viewName>
             <!--Optional:-->
             <soap1:query>
    		  <Where>
    			<Eq>				
    				<Field Name='DateMaj' />
    				<Value Type="DateTime"><Today/></Value>
    			</Eq>
    		</Where>
             </soap1:query>
          </soap1:GetListItems>
          <soap1:viewFields>
    		<Field Name='ID' />
    		<Field Name='TF1_DEI_UID' />
    		<Field Name='DateMaj' />
    		<Field Name='DateDebutEvenement' />
    		<Field Name='DateFinEvenement' />
    		<Field Name='Title' />
    		<Field Name='Contenu' />
    		<Field Name='Categorie' />
    		<Field Name='SousCategorie' />
    		<Field Name='NiveauImportance' />
    		<Field Name='Lien' />
    		<Field Name='Source' />
          </soap1:viewFields>
       </soap:Body>
    </soap:Envelope>

    Voici la réponse :

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <soap:Fault>
             <soap:Code>
                <soap:Value>soap:Receiver</soap:Value>
             </soap:Code>
             <soap:Reason>
                <soap:Text xml:lang="en">Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</soap:Text>
             </soap:Reason>
             <detail>
                <errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Element &lt;Query> of parameter query is missing or invalid.</errorstring>
                <errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000000</errorcode>
             </detail>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>

    Je sais que Sharepoint attend ceci : 

    POST /_vti_bin/lists.asmx HTTP/1.1 Host: nssdev.tf1.fr Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"> <listName>string</listName> <viewName>string</viewName> <query>string</query> <viewFields>string</viewFields> <rowLimit>string</rowLimit> <queryOptions>string</queryOptions> <webID>string</webID> </GetListItems> </soap12:Body> </soap12:Envelope> HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length -------------------------------------RÉPONSE------------------------------------------------

    <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"> <GetListItemsResult>string</GetListItemsResult> </GetListItemsResponse> </soap12:Body> </soap12:Envelope>

    J'ai déjà regarde les liens suivants :

    https://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx

    http://sharepoint.stackexchange.com/questions/46375/caml-query-in-getlistitems-method-returns-no-rows-of-items

    https://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(v=office.12).aspx

    https://msdn.microsoft.com/en-us/library/ms479601(v=office.12).aspx 

    (ainsi que ceux de la liste :

    • Query Schema
    • And Element
    • BeginsWith Element
    • Contains Element
    • DateRangesOverlap Element
    • Eq Element
    • FieldRef Element
    • Geq Element
    • GroupBy Element
    • Gt Element
    • IsNotNull Element
    • IsNull Element
    • Leq Element
    • Lt Element
    • Membership Element
    • Neq Element
    • Or Element
    • OrderBy Element
    • Query Element
    • Value Element
    • Where Element
    • XML Element)

    Seulement j'ai du mal a comprendre exactement ce qui faut.

    Je suis pas contre des exemples expliqué.

    Merci d'avance de votre aide,


    • Modifié WebForm vendredi 22 mai 2015 14:21
    vendredi 22 mai 2015 14:21

Réponses

  • Bonjour à tous,

    Voici la réponse au problème pour ceux qui ça intéresse :

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
       <soap:Header/>
       <soap:Body>
          <soap1:GetListItems>
             <!--Optional:-->
             <soap1:listName>Agenda</soap1:listName>
             <!--Optional:-->
             <soap1:query>
                 <Query>
                   <Where>
                      <Includes>
                         <FieldRef Name='TF1_DEI_UID'/>
                         <Value Type='Integer'>{0}</Value>
                      </Includes>
                   </Where>
                  </Query>
             </soap1:query>
             <!--Optional:-->
             <soap1:queryOption>
             </soap1:queryOption>
          </soap1:GetListItems>
       </soap:Body>
    </soap:Envelope>
    Bonne journée,

    • Marqué comme réponse WebForm mardi 2 juin 2015 09:25
    mardi 2 juin 2015 09:25

Toutes les réponses

  • Bonjour

    a vue d'oeil je dirais qu'il  manque le noeud queryOptions, même si il est vide. à tester...



    Blog Sharepoint : www.paslatek.net Twitter : @LimozinLionel

    lundi 25 mai 2015 14:04
  • Non ça marche pas...
    lundi 1 juin 2015 08:04
  • Bonjour à tous,

    Voici la réponse au problème pour ceux qui ça intéresse :

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
       <soap:Header/>
       <soap:Body>
          <soap1:GetListItems>
             <!--Optional:-->
             <soap1:listName>Agenda</soap1:listName>
             <!--Optional:-->
             <soap1:query>
                 <Query>
                   <Where>
                      <Includes>
                         <FieldRef Name='TF1_DEI_UID'/>
                         <Value Type='Integer'>{0}</Value>
                      </Includes>
                   </Where>
                  </Query>
             </soap1:query>
             <!--Optional:-->
             <soap1:queryOption>
             </soap1:queryOption>
          </soap1:GetListItems>
       </soap:Body>
    </soap:Envelope>
    Bonne journée,

    • Marqué comme réponse WebForm mardi 2 juin 2015 09:25
    mardi 2 juin 2015 09:25