2016-06-08 2 views
0

Je demande de savon EWS:L'attribut 'Traversal' n'est pas déclaré. Dans la demande GetItem EWS

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
    <soap:Header> 
     <t:ExchangeImpersonation> 
      <t:ConnectingSID> 
       <t:PrincipalName>[email protected]</t:PrincipalName> 
      </t:ConnectingSID> 
     </t:ExchangeImpersonation> 
    </soap:Header> 
    <soap:Body> 
     <m:GetItem Traversal="Shallow"> 
      <m:ItemShape> 
       <t:BaseShape>IdOnly</t:BaseShape> 
       <t:AdditionalProperties> 
        <t:FieldURI FieldURI="item:Subject"></t:FieldURI> 
        <t:FieldURI FieldURI="calendar:Start"></t:FieldURI> 
        <t:FieldURI FieldURI="calendar:End"></t:FieldURI> 
        <t:FieldURI FieldURI="calendar:Location"></t:FieldURI> 
        <t:FieldURI FieldURI="calendar:Organizer"></t:FieldURI> 
        <t:FieldURI FieldURI="item:Body"></t:FieldURI> 
        <t:FieldURI FieldURI="item:TextBody"></t:FieldURI> 
       </t:AdditionalProperties> 
      </m:ItemShape> 
      <m:ItemIds> 
       <t:ItemId Id="AAAUAHJvb20xQGV4Y2gyMDEwLmxvY2FsAEYAAAAAALp73pDts6BGkBAHp2xunxIHAOLiLPCbqYNEl0bu9R23VJMAAAAW2OQAAOLiLPCbqYNEl0bu9R23VJMAAAAXKY8AAA==" ChangeKey="DwAAAA=="></t:ItemId> 
      </m:ItemIds> 
     </m:GetItem> 
    </soap:Body> 
</soap:Envelope> 

erreur de réponse est:

<?xml version="1.0" encoding="utf-8"?> 
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
     <s:Body> 
      <s:Fault> 
       <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode> 
       <faultstring xml:lang="en-US">The request failed schema validation: The 'Traversal' attribute is not declared.</faultstring> 
       <detail> 
        <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode> 
        <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message> 
        <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
         <t:LineNumber>16</t:LineNumber> 
         <t:LinePosition>20</t:LinePosition> 
         <t:Violation>The 'Traversal' attribute is not declared.</t:Violation> 
        </t:MessageXml> 
       </detail> 
      </s:Fault> 
     </s:Body> 
    </s:Envelope> 

Pourquoi serait-il un échec?

demande similaires

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
    <soap:Header> 
     <t:ExchangeImpersonation> 
      <t:ConnectingSID> 
       <t:PrincipalName>[email protected]</t:PrincipalName> 
      </t:ConnectingSID> 
     </t:ExchangeImpersonation> 
    </soap:Header> 
    <soap:Body> 
     <m:FindItem Traversal="Shallow"> 
      <m:ItemShape> 
       <t:BaseShape>IdOnly</t:BaseShape> 
       <t:AdditionalProperties> 
        <t:FieldURI FieldURI="item:Subject"></t:FieldURI> 
        <t:FieldURI FieldURI="calendar:Start"></t:FieldURI> 
        <t:FieldURI FieldURI="calendar:End"></t:FieldURI> 
        <t:FieldURI FieldURI="calendar:Location"></t:FieldURI> 
       </t:AdditionalProperties> 
      </m:ItemShape> 
      <m:CalendarView StartDate="2016-05-30T11:08:48" EndDate="2016-12-31T11:08:48"></m:CalendarView> 
      <m:ParentFolderIds> 
       <t:FolderId Id="AAAUAHJvb20xQGV4Y2gyMDEwLmxvY2FsAC4AAAAAALp73pDts6BGkBAHp2xunxIBAOLiLPCbqYNEl0bu9R23VJMAAAAW2OQAAA==" ChangeKey="AgAAABYAAADi4izwm6mDRJdG7vUdt1STAAAAFtkD"></t:FolderId> 
      </m:ParentFolderIds> 
     </m:FindItem> 
    </soap:Body> 
</soap:Envelope> 

fonctionne parfaitement

EDIT 1:

J'ai enlevé attribut traversal et que eu erreur:

<?xml version="1.0" encoding="utf-8"?> 
<s:Envelope 
    xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Body> 
     <s:Fault> 
      <faultcode 
       xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation 
      </faultcode> 
      <faultstring xml:lang="en-US">The request failed schema validation: The 'FieldURI' attribute is invalid - The value 'item:TextBody' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</faultstring> 
      <detail> 
       <e:ResponseCode 
        xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation 
       </e:ResponseCode> 
       <e:Message 
        xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation. 
       </e:Message> 
       <t:MessageXml 
        xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
        <t:LineNumber>3</t:LineNumber> 
        <t:LinePosition>649</t:LinePosition> 
        <t:Violation>The 'FieldURI' attribute is invalid - The value 'item:TextBody' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</t:Violation> 
       </t:MessageXml> 
      </detail> 
     </s:Fault> 
    </s:Body> 
</s:Envelope> 

Puis j'ai enlevé la dernière propriété supplémentaire

<t:FieldURI FieldURI="item:TextBody"></t:FieldURI> 

et finalement obtenu cette erreur.

<?xml version="1.0" encoding="utf-8"?> 
<s:Envelope 
    xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
     <h:ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="123" MinorBuildNumber="3" Version="Exchange2010_SP2" 
      xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" 
      xmlns="http://schemas.microsoft.com/exchange/services/2006/types" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"/> 
     </s:Header> 
     <s:Body 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
      <m:GetItemResponse 
       xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
       xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
       <m:ResponseMessages> 
        <m:GetItemResponseMessage ResponseClass="Error"> 
         <m:MessageText>The EWS Id is in EwsLegacyId format which is not supported by the Exchange version specified by your request. Please use the ConvertId method to convert from EwsLegacyId to EwsId format.</m:MessageText> 
         <m:ResponseCode>ErrorInvalidIdMalformedEwsLegacyIdFormat</m:ResponseCode> 
         <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey> 
         <m:Items/> 
        </m:GetItemResponseMessage> 
       </m:ResponseMessages> 
      </m:GetItemResponse> 
     </s:Body> 
    </s:Envelope> 

Veuillez nous aviser.

Répondre

1

Il n'y a pas d'attribut traversal dans l'élément GetItem vous pouvez consulter la documentation de référence https://msdn.microsoft.com/en-us/library/aa563775(v=exchg.150).aspx

Traversées ne sont valables que dans les opérations FindItem et FindFolder (ses Précise ce que la portée des dossiers que vous cherchez). GetItem obtient simplement un élément particulier pour lequel vous avez l'ID (L'ID contient les informations permettant de localiser l'élément afin qu'aucun contexte de dossier/boîte aux lettres ne soit nécessaire). Cela dit, si vous n'avez pas de droits sur l'élément en question et que vous essayez d'utiliser GetItem, l'erreur signalée sera que l'objet n'existe pas dans le magasin (ce qui est un peu décevant).

Modifier 1

Vous devez commencer versioning toutes les EWS demandes que vous faites par exemple dans l'en-tête

<soap:Header> 
 
     <t:RequestServerVersion Version="Exchange2010_SP2" /> 
 
    </soap:Header>

Vous devez mettre la version du schéma https://msdn.microsoft.com/en-us/library/office/dn741586(v=exchg.150).aspx vous travailler avec (ou au moins mettre Exchange2007_SP1). Cela résoudra l'erreur EWSId (vous ne pourrez pas utiliser l'identifiant que vous essayez d'utiliser, mais vous devriez obtenir l'ID correct de l'autre requête que vous avez obtenue).

+0

Pourriez-vous s'il vous plaît jeter un oeil à ma dernière édition. – eomeroff