0
votes

My goal is to update the subject of an Emailmessage using makeewsrequestasync. At first I issue a GetItem request to get the latest ChangeKey of the message i want to update. This request works fine and i succesfully get the item ChangeKey.

After that I send another request to finally update my Email subject. However, i always get an internal server error with error code 500. Below is the request i send in the data object of the makeewsrequestasync method.

<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap = 'https://schemas.xmlsoap.org/soap/envelope/'>               xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types'>  <soap:Header>    <t:RequestServerVersion Version='Exchange2013'/>  </soap:Header>  <soap:Body>     <UpdateItem MessageDisposition='SaveOnly' ConflictResolution='AutoResolve' xmlns='http://schemas.microsoft.com/exchange/services/2006/messages'>       <ItemChanges>        <t:ItemChange>         <t:ItemId Id='AAMkAGNkZWM1OTUzLTVhMzAtNDQyZS1hYzNmLTFhNDQ5ODc4NTYwMABGAAAAAABB8zSmRPuuRoRPHF1NS2srBwA9GscujNfkQL9s6uP7T+MpAAAAAAEMAADOgKz/bqQyTqxlZnzyc9ndAAH8Uu4tAAA=' ChangeKey='CQAAABYAAADOgKz/bqQyTqxlZnzyc9ndAAILRklX'/>         <t:Updates>           <t:SetItemField>            <t:FieldURI FieldURI='item:Subject'/>            <t:Message>              <t:Subject>[Venga] MyAnalytics | Network Edition</t:Subject>             </t:Message>             </t:SetItemField >           </t:Updates>          </t:ItemChange>         </ItemChanges>        </UpdateItem>  </soap:Body></soap:Envelope>

I already tried several ways to Update my subject, but unfortunetaly without success. There is a similar question which i used to build my request (similar Question), but I always end up in the Internal Server Error. I would love to get an advice, how to resolve this issue.

1

1 Answers

1
votes

There are multiple issues with your XML request (it's not even valid XML)

<soap:Envelope xmlns:soap = 'https://schemas.xmlsoap.org/soap/envelope/'>

The namespace schema is wrong you have modified the correct schema to https note this has nothing to do with using http or https is just the schema definition and by changing it you have made it invalid. You have also added an extra > at the end which closes the tag but you have extra namespace attributes that should be included in the namespace which just become invalid text at that point in your request eg it should be

<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types'>

You also have extra whitespace in the closing SetItemField tag. This appears to be valid now

<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope
    xmlns:soap = 'http://schemas.xmlsoap.org/soap/envelope/'
    xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types'>
    <soap:Header>
        <t:RequestServerVersion Version='Exchange2013'/>
    </soap:Header>
    <soap:Body>
        <UpdateItem MessageDisposition='SaveOnly' ConflictResolution='AutoResolve'
            xmlns='http://schemas.microsoft.com/exchange/services/2006/messages'>
            <ItemChanges>
                <t:ItemChange>
                    <t:ItemId Id='AAMkAGNkZWM1OTUzLTVhMzAtNDQyZS1hYzNmLTFhNDQ5ODc4NTYwMABGAAAAAABB8zSmRPuuRoRPHF1NS2srBwA9GscujNfkQL9s6uP7T+MpAAAAAAEMAADOgKz/bqQyTqxlZnzyc9ndAAH8Uu4tAAA=' ChangeKey='CQAAABYAAADOgKz/bqQyTqxlZnzyc9ndAAILRklX'/>
                    <t:Updates>
                        <t:SetItemField>
                            <t:FieldURI FieldURI='item:Subject'/>
                            <t:Message>
                                <t:Subject>[Venga] MyAnalytics | Network Edition</t:Subject>
                            </t:Message>
                        </t:SetItemField>
                    </t:Updates>
                </t:ItemChange>
            </ItemChanges>
        </UpdateItem>
    </soap:Body>
</soap:Envelope>