Outlook Web Access add-in questions - outlook-addin

I started developing add-in for OWA for Exchange 2013.
I have a couple of questions related to it.
I would be happy if someone could help me with them.
Is it possible to add button(via add-in commands in manifest) to the top pane in OWA?
http://screencast.com/t/CvOqOsnI
Is it possible to get the content of a message? Let's say byte array or base64 string... I've looked through the documentation and have found nothing about it.
Office.context.mailbox.item doesn't have method or property to get the content of the message.
Thank you in advance.

As I understand you want to put your extension together with "Move to" and "Categories". If that is what you want, I want to say that it is not possible.
Here I have workaround, you can send SOAP request to the Exchange API and get the mail content.

Add-in commands are currently only supported in Outlook 2013 and 2016. They will most likely be available in Outlook Online and Outlook.com at a future date.
If Outlook.context.mailbox.item.Body.getAsync is not sufficient and you need the full MIME content of the message, use mailbox.makeEWSRequestAsync with a GetItem call that includes the 7C08 extended property:
<!--Call:-->
<?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:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ItemShape>
<t:BaseShape>Default</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="item:Body" />
<t:FieldURI FieldURI="item:Subject" />
<t:ExtendedFieldURI PropertyTag="7C08" PropertyType="Binary" />
</t:AdditionalProperties>
</ItemShape>
<ItemIds>
<t:ItemId Id="AAMkAGUzNmEzYTBmLTI1NDItNGE0My1iZDk5LWFkMDgxODI3YWNlOQBGAAAAAACK2VEhi72QSaw+u0XV7xUHBwCMotTyA3QkQ7TPAmcrRt4FAAAALwVMAAAuH/1UA8tzTYD5jbYriaIUAAAJ5576AAA=" />
</ItemIds>
</GetItem>
</soap:Body>
</soap:Envelope>
<!--Response:-->
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="396" MinorBuildNumber="20" Version="V2015_10_05" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</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="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:Message>
<t:MimeContent CharacterSet="UTF-8">U3ViamVjdDoNClRocmVhZC1JbmRleDogQVFIT3hWSjZLdTJONnltWUxVNlBtQWNpamJYaTdBPT0NCkRhdGU6IFRodSwgMTAgT2N0IDIwMTMgMDA6NDg6NDggKzAwMDANCk1lc3NhZ2UtSUQ6DQoJPGI3MDM3MWNkYjkyZTRhYjc4NzFlM2FjYjgzZjVmMmJlQEJOMVBSMDRNQjM1OC5uYW1wcmQwNC5wcm9kLm91dGxvb2suY29tPg0KQ29udGVudC1MYW5ndWFnZTogZW4tQ0ENClgtTVMtSGFzLUF0dGFjaDoNClgtTVMtVE5FRi1Db3JyZWxhdG9yOg0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PSJ1cy1hc2NpaSINCk1JTUUtVmVyc2lvbjogMS4wDQoNCg==</t:MimeContent>
<t:ItemId Id="AAMkAGUzNmEzYTBmLTI1NDItNGE0My1iZDk5LWFkMDgxODI3YWNlOQBGAAAAAACK2VEhi72QSaw+u0XV7xUHBwCMotTyA3QkQ7TPAmcrRt4FAAAALwVMAAAuH/1UA8tzTYD5jbYriaIUAAAJ5576AAA=" ChangeKey="CQAAABYAAAAuH/1UA8tzTYD5jbYriaIUAAAJ6HVa"/>
<t:Sensitivity>Normal</t:Sensitivity>
<t:Body BodyType="Text" IsTruncated="false"/>
<t:Size>1618</t:Size>
<t:DateTimeSent>2013-10-10T00:48:48Z</t:DateTimeSent>
<t:DateTimeCreated>2013-10-10T00:48:47Z</t:DateTimeCreated>
<t:ResponseObjects>
<t:ForwardItem/>
</t:ResponseObjects>
<t:HasAttachments>false</t:HasAttachments>
<t:IsAssociated>true</t:IsAssociated>
<t:IsReadReceiptRequested>false</t:IsReadReceiptRequested>
<t:IsRead>true</t:IsRead>
</t:Message>
</m:Items>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</s:Body>
</s:Envelope>

Related

How to write SQL inside XML SOAP request - salesforce marketing cloud API

I am new to SOAP.
I am trying to get the Send Object information and I am able to pull all the data I need except
SendID
This is the request I make in postman
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<fueloauth>{{sf_ps_access_token}}</fueloauth>
</soapenv:Header>
<soapenv:Body>
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>Send</ObjectType>
<Properties>ID</Properties>
<Properties>BCCEmail</Properties>
<Properties>SendID</Properties>
<Properties>Client.PartnerClientKey</Properties>
<Properties>PartnerKey</Properties>
<Properties>CreatedDate</Properties>
<Properties>ModifiedDate</Properties>
<Properties>Client.ID</Properties>
<Properties>Email.ID</Properties>
<Properties>Email.PartnerKey</Properties>
<Properties>SendDate</Properties>
<Properties>FromAddress</Properties>
<Properties>FromName</Properties>
<Properties>Duplicates</Properties>
<Properties>InvalidAddresses</Properties>
<Properties>HardBounces</Properties>
<Properties>SoftBounces</Properties>
<Properties>OtherBounces</Properties>
<Properties>ForwardedEmails</Properties>
<Properties>UniqueClicks</Properties>
<Properties>UniqueOpens</Properties>
<Properties>NumberSent</Properties>
<Properties>NumberDelivered</Properties>
<Properties>NumberTargeted</Properties>
<Properties>NumberErrored</Properties>
<Properties>NumberExcluded</Properties>
<Properties>Unsubscribes</Properties>
<Properties>MissingAddresses</Properties>
<Properties>Subject</Properties>
<Properties>PreviewURL</Properties>
<Properties>SentDate</Properties>
<Properties>EmailName</Properties>
<Properties>Status</Properties>
<Properties>EmailSendDefinition.ObjectID</Properties>
<Properties>EmailSendDefinition.CustomerKey</Properties>
<Properties>Client.PartnerClientKey</Properties>
<Properties>Email.PartnerKey</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>CreatedDate</Property>
<SimpleOperator>between</SimpleOperator>
<DateValue>2018-01-01</DateValue>
<DateValue>2021-12-09</DateValue>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</soapenv:Body>
</soapenv:Envelope>
This is the error I am getting:
Error: Column 'dbo.tblJobs.SendID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
How do I write SQL inside the xml SOAP request?
My response on this one is late. I think the problem is ,
In Send object (<ObjectType>Send</ObjectType>) there is no field as SendID. If you need Job Id inorder to connect other tracking, you need to use "ID" attribute. You can further improve using BatchId
SendID is present in other event like clicks or open. You can use SendId in those event for filtering the data
Sample message for getting send info :
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{AccessToken}}</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Options>
</Options>
<RetrieveRequest>
<ObjectType>Send</ObjectType>
<Properties>Client.ID</Properties>
<Properties>Email.ID</Properties>
<Properties>EmailName</Properties>
<Properties>Subject</Properties>
<Properties>SendDate</Properties>
<Properties>CreatedDate</Properties>
<Properties>Status</Properties>
<Properties>FromAddress</Properties>
<Properties>FromName</Properties>
<Properties>ID</Properties>
<Properties>NumberSent</Properties>
<Properties>NumberDelivered</Properties>
<Properties>ForwardedEmails</Properties>
<Properties>NumberErrored</Properties>
<Properties>NumberExcluded</Properties>
<Properties>ExistingUndeliverables</Properties>
<Properties>ExistingUnsubscribes</Properties>
<Properties>SoftBounces</Properties>
<Properties>HardBounces</Properties>
<Properties>OtherBounces</Properties>
<Properties>Unsubscribes</Properties>
<Properties>UniqueOpens</Properties>
<Properties>UniqueClicks</Properties>
<Properties>PreviewURL</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>ID</Property>
<SimpleOperator>between</SimpleOperator>
<Value>1</Value><Value>10000</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</s:Body>
</s:Envelope>
Once you have the JobId(ID) from above , you can use it to get other tracking .
Using the job Id to get all related sent tracking :
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{AccessToken}}</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Options>
</Options>
<RetrieveRequest>
<ObjectType>SentEvent</ObjectType>
<Properties>Client.ID</Properties>
<Properties>SubscriberKey</Properties>
<Properties>EventDate</Properties>
<Properties>SendID</Properties>
<Properties>BatchID</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>SendID</Property>
<SimpleOperator>between</SimpleOperator>
<Value>1</Value><Value>9000</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</s:Body>
</s:Envelope>

Not able to move a message to a specific folder in outlook addin

My outlook addin uses "ReadWriteMailbox" permission. I am trying to use makeEwsRequestAsync method and send a EWS "MoveItem" request to move the message to a specific folder. But i am getting the following errror,
"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 the Id from EwsId to EwsLegacyId format."
Request Sent
<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:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ToFolderId>
<t:FolderId Id="AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADb64+wAAA=" ChangeKey="AQAAABYAAAAjK9sGaxZsQpt2dmaMGjhaAADcIrnw"/>
</ToFolderId>
<ItemIds>
<t:ItemId Id="AAMkAGJiNjY2ZTk1LTZkMDEtNGQyYy05M2M2LWMyZmQwMzY1M2JhMQBGAAAAAACALDzcpfeRQ7ZlsoKB0iVmBwArZr3QPuquTIplat84SmYEAEq/mAl5AAAjK9sGaxZsQpt2dmaMGjhaAADb62uqAAA="/>
</ItemIds>
</MoveItem>
</soap:Body>
</soap:Envelope>
Response Received
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1075" MinorBuildNumber="20" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:MoveItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:MoveItemResponseMessage 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 the Id from EwsId to EwsLegacyId format.
</m:MessageText>
<m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:MoveItemResponseMessage>
</m:ResponseMessages>
</m:MoveItemResponse>
</s:Body>
</s:Envelope>
I am able to use the MoveItem EWS operation and move the messages to "Junk Email" folder. But i want to move messages to a specific folder created by a earlier "CreateFolder" EWS operation. The id of the folder is "AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADb64+wAAA="
Using the above id in "GetFolder" operation correctly returns the no. of items in the folder. But I am not able to get the "MoveItem" operation to work. All the EWS operations are performed via the "makeEwsRequestAsync" call. Could you help with this?
Updates
CreateFolder Request:
<?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:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<CreateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ParentFolderId><t:DistinguishedFolderId Id="msgfolderroot"/></ParentFolderId> <Folders><t:Folder><t:DisplayName>Submissions</t:DisplayName></t:Folder></Folders>
</CreateFolder>
</soap:Body>
</soap:Envelope>
Create Folder Response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1075" MinorBuildNumber="21" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:CreateFolderResponse
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:CreateFolderResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder><t:FolderId Id="AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADek+aFAAA=" ChangeKey="AQAAABYAAAAjK9sGaxZsQpt2dmaMGjhaAADeyyJ9"/>
</t:Folder>
</m:Folders>
</m:CreateFolderResponseMessage>
</m:ResponseMessages>
</m:CreateFolderResponse>
</s:Body>
</s:Envelope>
Move Item Request:
<?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:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header> <RequestServerVersion Version="Exchange2013" /> </soap:Header>
<soap:Body>
<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ToFolderId>
<t:FolderId Id="AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADek+aFAAA=" ChangeKey="AQAAABYAAAAjK9sGaxZsQpt2dmaMGjhaAADeyyJ9"/>
</ToFolderId>
<ItemIds>
<t:ItemId Id="AAMkAGJiNjY2ZTk1LTZkMDEtNGQyYy05M2M2LWMyZmQwMzY1M2JhMQBGAAAAAACALDzcpfeRQ7ZlsoKB0iVmBwArZr3QPuquTIplat84SmYEAEq/mAl5AAAjK9sGaxZsQpt2dmaMGjhaAADdyMHzAAA="/>
</ItemIds>
</MoveItem>
</soap:Body>
</soap:Envelope>
Move Item Response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1075" MinorBuildNumber="21" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:MoveItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:MoveItemResponseMessage 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 the Id from EwsId to EwsLegacyId format.
</m:MessageText>
<m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:MoveItemResponseMessage>
</m:ResponseMessages>
</m:MoveItemResponse>
</s:Body>
</s:Envelope>
More likely your requests to "CreateFolder" and request "MoveItem" have different "RequestServerVersion". Read more on EWS schema versions in Exchange. EWS Id format has been changed I believe in "Exchange2007_SP1" version. This make me think you have used the example for "CreateFolder" request which include "RequestServerVersion" set to "Exchange2007" and it will return legacy folder Id.
EDIT:
I didn't try to reproduce your requests/response sequence, instead I used documented ways to send the following requests:
CreateFolder operation
MoveItem operation
Request to create the folder looks like ...
<?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:RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />
</soap:Header>
<soap:Body>
<CreateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ParentFolderId>
<t:DistinguishedFolderId Id="msgfolderroot"/>
</ParentFolderId>
<Folders>
<t:Folder>
<t:DisplayName>Test Folder1</t:DisplayName>
</t:Folder>
</Folders>
</CreateFolder>
</soap:Body>
</soap:Envelope>
And response is ...
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1084" MinorBuildNumber="21" Version="V2017_04_14" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:CreateFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:CreateFolderResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder>
<t:FolderId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwAuAAADEgGHnGK1T06Yq8xwQCjiHwEAkUJPW0th2EGwjXYeK6AWSQABv62c1AAAAA==" ChangeKey="AQAAABYAAACRQk9bS2HYQbCNdh4roBZJAAG/8ffU"/>
</t:Folder>
</m:Folders>
</m:CreateFolderResponseMessage>
</m:ResponseMessages>
</m:CreateFolderResponse>
</s:Body>
</s:Envelope>
The folder created successfully. As per documentation to perform MoveItem request I need the item's change key. I performed GetItem request and got the following response ...
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1084" MinorBuildNumber="21" Version="V2017_04_14" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</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="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:Message>
<t:ItemId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwBGAAADEgGHnGK1T06Yq8xwQCjiHwcAkUJPW0th2EGwjXYeK6AWSQAAAgEMAAAAkUJPW0th2EGwjXYeK6AWSQABv62YlAAAAA==" ChangeKey="CQAAABYAAACRQk9bS2HYQbCNdh4roBZJAAG/8awE"/>
</t:Message>
</m:Items>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</s:Body>
</s:Envelope>
And finally I need to move the item. The following is my request to move the item ....
<?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:RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />
</soap:Header>
<soap:Body>
<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<ToFolderId>
<t:FolderId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwAuAAADEgGHnGK1T06Yq8xwQCjiHwEAkUJPW0th2EGwjXYeK6AWSQABv62c1AAAAA=="/>
</ToFolderId>
<ItemIds>
<t:ItemId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwBGAAADEgGHnGK1T06Yq8xwQCjiHwcAkUJPW0th2EGwjXYeK6AWSQAAAgEMAAAAkUJPW0th2EGwjXYeK6AWSQABv62YlAAAAA==" ChangeKey="CQAAABYAAACRQk9bS2HYQbCNdh4roBZJAAG/8awE"/>
</ItemIds>
</MoveItem>
</soap:Body>
</soap:Envelope>
It is succeeded and item has been moved to my new folder.
The following are suggestions for you to proceed with your debugging ...
Look at the request how you get the itemId. The issue may be there. You need to specify the same "RequestServerVersion" to get the ChangeKey.
I suggest you to have common function for all SOAP request you do to wrap each request body. In this case you will not get in trouble with legacy data.
Something like this, very simple wrapper ...
/**
* Wrap an Exchange Web Services request in a SOAP envelope.
* #private
* #param {string} payload request XML.
* #return {string} Ready to send SOAP EWS request.
*/
function _wrapSoapEnvelope(payload) {
var result = '<?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:RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />' +
'</soap:Header>' +
'<soap:Body>' + payload + '</soap:Body>' +
'</soap:Envelope>';
return result;
};
In this case your requests will be very simple and unified (the following 3 requests I have used for your case) ...
this.createFolderRequest = function (folderName) {
var result = '<CreateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' +
'<ParentFolderId>' +
'<t:DistinguishedFolderId Id="msgfolderroot"/>' +
'</ParentFolderId>' +
'<Folders>' +
'<t:Folder>' +
'<t:DisplayName>' + folderName + '</t:DisplayName>' +
'</t:Folder>' +
'</Folders>' +
'</CreateFolder>';
return _wrapSoapEnvelope(result);
};
this.moveItemRequest = function (folderId, itemId, changeKey) {
var result = '<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">' +
'<ToFolderId>' +
'<t:FolderId Id="' + folderId + '"/>' +
'</ToFolderId>' +
'<ItemIds>' +
'<t:ItemId Id="' + itemId + '" ChangeKey="' + changeKey + '"/>' +
'</ItemIds>' +
'</MoveItem>';
return _wrapSoapEnvelope(result);
};
this.getChangeKeyRequest = function (itemId) {
var result = '<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' +
'<ItemShape>' +
'<t:BaseShape>IdOnly</t:BaseShape>' +
'</ItemShape>' +
'<ItemIds><t:ItemId Id="' + itemId + '"/></ItemIds>' +
'</GetItem>';
return _wrapSoapEnvelope(result);
};
I suggest you check your requests as they are look different and follow Microsoft original documentation, instead of examples taken from other sources.
And this is it. The purpose of SO is QandA, not remote debugging, so you are on your own with your code issues. Please take a time to debug, clean up your code as well as read a bit more on documentation provided and you'll make it work.

Does creating a logical outlook search folder decrease search lag?

I create a logical search folder to contain all the emails with a specific category. I then pull those emails using FindItem+ParentFolderIds query. The speed of this FindItem query seems to be proportional to the total number of emails in the account and not how many emails in the logical search folder. Is this normal behavior?
Here is the query to create the search folder:
<?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="Exchange2010" />
</soap:Header>
<soap:Body>
<m:CreateFolder>
<m:ParentFolderId>
<t:DistinguishedFolderId Id="searchfolders" />
</m:ParentFolderId>
<m:Folders>
<t:SearchFolder>
<t:DisplayName>MySearchFolder</t:DisplayName>
<t:PermissionSet>
<t:Permissions />
</t:PermissionSet>
<t:SearchParameters Traversal="Deep">
<t:Restriction>
<t:Contains ContainmentMode="FullString" ContainmentComparison="IgnoreCase">
<t:FieldURI FieldURI="item:Categories" />
<t:Constant Value="My_Category" />
</t:Contains>
</t:Restriction>
<t:BaseFolderIds>
<t:DistinguishedFolderId Id="root" />
</t:BaseFolderIds>
</t:SearchParameters>
</t:SearchFolder>
</m:Folders>
</m:CreateFolder>
</soap:Body>
</soap:Envelope>
And here's the query to retrieve the emails from the search folder:
<?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:FindItem Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>AllProperties</t:BaseShape>
</m:ItemShape>
<m:IndexedPageItemView MaxEntriesReturned="1000" Offset="0" BasePoint="Beginning" />
<m:Restriction>
<t:IsEqualTo>
<t:FieldURI FieldURI="item:IsDraft" />
<t:FieldURIOrConstant>
<t:Constant Value="false" />
</t:FieldURIOrConstant>
</t:IsEqualTo>
</m:Restriction>
<m:ParentFolderIds>
<t:FolderId Id="<The_SEARCH_FOLDER_ID>" />
</m:ParentFolderIds>
</m:FindItem>
</soap:Body>
</soap:Envelope>
Keep in mind that items aren't actually "in" a search folder. A search folder is really just a persistent search result that you can treat like a folder. So those items are still all spread out across different folders in the mailbox.
When you query the search folder you're adding a second restriction (IsDraft = false) which is likely causing the results to be reevaluated.

Why does .NET XMLSerializer automatically change my namespace prefixes (alias)?

I am working on a web service that needs to return faults in a way that is defined by the standards of our type of business. This requires me to return a fault as this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" />
</wsse:Security>
</soap:Header>
<soap:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Operator/operand type mismatch.</faultstring>
<faultactor>urn:dealernumberID:??????</faultactor>
<detail>
<ErrorType xmlns="http://www.starstandards.org/webservices/2009/transport">Backend Client Fault</ErrorType>
<ErrorDetail xmlns="http://www.starstandards.org/webservices/2009/transport">Backend client returned a fault</ErrorDetail>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I create the fault like this, but when the service sends it, it looks like this:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" />
</h:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<s:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Operator/operand type mismatch.</faultstring>
<faultactor>urn:dealernumberID:??????</faultactor>
<detail>
<ErrorType xmlns="http://www.starstandards.org/webservices/2009/transport">Backend Client Fault</ErrorType>
<ErrorDetail xmlns="http://www.starstandards.org/webservices/2009/transport">Backend client returned a fault</ErrorDetail>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Why does this happen? Is there a setting that I can change in .NET to keep it from doing this by default? I do understand that a namespace is a namespace regardless of the prefix, but like I said, the standard dictates we do it a certain way (most likely to accommodate third parties that are reading responses as strings?)
Thanks for any help!

Sonos API Browse container two-line displayy

For reason the two-line display of containers in browse are not working, via search it works perfectly. Can someone please review below output?
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getMetadataResponse xmlns="http://www.sonos.com/Services/1.1">
<getMetadataResult>
<index>0</index>
<count>2</count>
<total>2</total>
<mediaCollection>
<canPlay>true</canPlay>
<id>album-1200</id>
<title>En de wind stilde</title>
<itemType>album</itemType>
<artistId>artist-5716</artistId>
<artist>Ds. D.W. Tuinier</artist>
<albumArtURI>http://***/albumart.php?album_id=1200&size=200</albumArtURI>
</mediaCollection>
<mediaCollection>
<canPlay>true</canPlay>
<id>album-1163</id>
<title>De Tas</title>
<itemType>album</itemType>
<artistId>artist-5619</artistId>
<artist>Ben de Raaf</artist>
<albumArtURI>http://***/albumart.php?album_id=1163&size=200</albumArtURI>
</mediaCollection>
</getMetadataResult>
</getMetadataResponse>
</soap:Body>
</soap:Envelope>
The source of the problem was located in the parent container, the itemType of the parent container should be AlbumList instead of a container.
Many thanks Sonos Developer Advocacy.