尝试删除Contact PhysicalAddress会导致ErrorSchemaValidation响应

时间:2016-05-10 14:29:17

标签: exchange-server exchangewebservices

尝试从联系人中删除整个地址时,出现“请求失败的架构验证”错误。我的请求看起来像这样

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:ns1="http://schemas.microsoft.com/exchange/services/2006/types"
                   xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages">
    <SOAP-ENV:Header>
        <ns1:RequestServerVersion Version="Exchange2010"/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns2:UpdateItem ConflictResolution="AlwaysOverwrite" MessageDisposition="SaveOnly">
            <ns2:ItemChanges>
                <ns1:ItemChange>
                    <ns1:ItemId
                        Id="..."
                        ChangeKey=".."/>
                    <ns1:Updates>
                        <ns1:DeleteItemField>
                            <ns1:IndexedFieldURI FieldURI="contacts:PhysicalAddress" FieldIndex="Business"/>
                        </ns1:DeleteItemField>
                    </ns1:Updates>
                </ns1:ItemChange>
            </ns2:ItemChanges>
        </ns2:UpdateItem>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是我的回复

<?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 'contacts:PhysicalAddress' is invalid according to its datatype
            'http://schemas.microsoft.com/exchange/services/2006/types:DictionaryURIType' - 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>2</t:LineNumber>
                <t:LinePosition>717</t:LinePosition>
                <t:Violation>The 'FieldURI' attribute is invalid - The value 'contacts:PhysicalAddress' is invalid
                    according to its datatype
                    'http://schemas.microsoft.com/exchange/services/2006/types:DictionaryURIType' - The Enumeration
                    constraint failed.
                </t:Violation>
            </t:MessageXml>
        </detail>
    </s:Fault>
</s:Body>
</s:Envelope>

尝试删除合同的商家地址。然而,问题在于没有contacts:PhysicalAddress DictionaryFieldURI,只有地址的每个字段都有DictionaryFieldURI。同样,我不能只传递contacts:PhysicallAddresses字段URI,因为它没有被索引,因此我无法指定要删除哪个地址。

那么我的请求应该是什么样才能删除联系人的业务实际地址?

1 个答案:

答案 0 :(得分:1)

它们物理地址是一系列属性,无法按照您尝试的方式删除,您需要浏览每个属性(例如城市,地址等)并删除您要制作的属性空值。例如

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2013_SP1" />
  </soap:Header>
  <soap:Body>
    <m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite">
      <m:ItemChanges>
        <t:ItemChange>
          <t:ItemId Id="AAMkADczNDE4YWEwLTdlZLrCDQAAE1MmZPAAA=" ChangeKey="EQAAABYAAAB1EEf9GOowTZ1AsUKLrCDQAAE1Vhdy" />
          <t:Updates>
            <t:DeleteItemField>
              <t:IndexedFieldURI FieldURI="contacts:PhysicalAddress:City" FieldIndex="Business" />
            </t:DeleteItemField>
          </t:Updates>
        </t:ItemChange>
      </m:ItemChanges>
    </m:UpdateItem>
  </soap:Body>
</soap:Envelope>

干杯 格伦