Extended property in EWS - email

I am interacting with exchange to extract emails having particular extended property. I am able to fetch email that I have sent with newly created extended properties, but when I reply to the emails, these properties are not preserved..Is this normal behavior? Is there anyway to work around it?
The code I am using to send and fetch email for now is as below
To send email with extended property
`<?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:CreateItem MessageDisposition="SendAndSaveCopy">
<m:SavedItemFolderId>
<t:DistinguishedFolderId Id="sentitems" />
</m:SavedItemFolderId>
<m:Items>
<t:Message>
<t:Subject>Greetings</t:Subject>
<t:Body BodyType="Text">Message with extended property attached</t:Body>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e"
PropertyName="extended_property_name" PropertyType="String" />
<t:Value>NEWVALUE</t:Value>
</t:ExtendedProperty>
<t:ToRecipients>
<t:Mailbox>
<t:EmailAddress>test#cisco.com</t:EmailAddress>
</t:Mailbox>
</t:ToRecipients>
</t:Message>
</m:Items>
</m:CreateItem>
</soap:Body>
</soap:Envelope>`
Fetching email with extended property
`<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
</soapenv:Header>
<soapenv:Body>
<mes:FindItem Traversal="Shallow">
<mes:ItemShape>
<typ:BaseShape>Default</typ:BaseShape>
<typ:IncludeMimeContent>false</typ:IncludeMimeContent>
<typ:BodyType>Best</typ:BodyType>
</mes:ItemShape>
<mes:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning"/>
<mes:GroupBy Order="Ascending">
<typ:FieldURI FieldURI="item:DateTimeReceived" />
<typ:AggregateOn Aggregate="Maximum">
<typ:FieldURI FieldURI="item:ItemId"/>
</typ:AggregateOn>
</mes:GroupBy>
<mes:Restriction>
<typ:IsEqualTo>
<typ:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e" PropertyName="extended_property_name" PropertyType="String" />
<typ:FieldURIOrConstant>
<typ:Constant Value="NEWVALUE" />
</typ:FieldURIOrConstant>
</typ:IsEqualTo>
</mes:Restriction>
<mes:ParentFolderIds>
<!--You have a CHOICE of the next 2 items at this level-->
<typ:FolderId Id="[Process.Variables.Completed Id]"
ChangeKey="[Process.Variables.Completed ChangeKey]"/>
</mes:ParentFolderIds>
</mes:FindItem>
</soapenv:Body>
</soapenv:Envelope>`
Any Help will be greatly appreciated!
Thanks

Yes that is normal the extended properties your setting are for the message your sending, the response is a brand new message and won't contain any custom properties you have set (this would actually be more of a problem if it did). If your trying to correlate response and reply then you should look at the InReplyto,Referances or ConversationId eg http://blog.mailgun.com/tracking-replies-in-mailgun-or-any-other-email/
cheers
Glen

Related

Invalid white space character (0x8) in text to output

While i am getting response in through soap, i am getting this exception for some time. please help in finding the solution.
Pasting the whole soap response below.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Receiver</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Invalid white space character (0x8) in text to output</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Monitoring multiple folders in one 'syncFolderItems' operation?

Is it possible to monitor several folders in one 'syncFolderItems' operation?
I tried it, but It doesn't seem to work.
For example, this:
<?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:Body>
<SyncFolderItems xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ItemShape>
<t:BaseShape>Default</t:BaseShape>
</ItemShape>
<SyncFolderId>
<t:DistinguishedFolderId Id="drafts"/>
<t:DistinguishedFolderId Id="inbox"/>
</SyncFolderId>
<MaxChangesReturned>500</MaxChangesReturned>
</SyncFolderItems>
</soap:Body>
</soap:Envelope>
doesn't work :(
is it possible?
Thanks :)
I know this is very old question but, still it is important for other user so i am answering.
No it is not Possible
SyncFolderId can have one child tag FolderID or DistinguishedFolderID
<SyncFolderId>
<FolderId/>
</SyncFolderId>
<SyncFolderId>
<DistinguishedFolderId/>
</SyncFolderId>
reference link http://msdn.microsoft.com/en-us/library/exchange/aa580296%28v=exchg.80%29.aspx

Post XML String in SOAP message

I want some help friends,
I want to Post XML string in SOAP message in iOS sdk.
Is it possible to do this?
If yes, Please give me some sample code for that. otherwise advice me alternative way to do this.
Please help me to come out from this problem.
Thanks in advance.
Code:
<?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/">
<soap:Body>
<postCourseUsage xmlns="http://tempuri.org/">
<xml><?xml version="1.0"?><CU><ULID>admin</ULID><CID>myOwn</CID><CURS><CUR><CN>Home</CN><USG><CUSG>2</CUSG><SD>12-Jul-2011 12:41:42</SD></USG></CUR></CURS></CU></xml>
</postCourseUsage>
</soap:Body>
</soap:Envelope>
I got my answer.
<?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/">
<soap:Body>
<postCourseUsage xmlns="http://tempuri.org/">
<xml><?xml version="1.0"?><CU><ULID>admin</ULID><CID>myOwn</CID><CURS><CUR><CN>Home</CN><USG><CUSG>2</CUSG><SD>12-Jul-2011 12:41:42</SD></USG></CUR></CURS></CU></xml>
</postCourseUsage>
</soap:Body>
</soap:Envelope>
Using this code i can pass xml string as argument in soap message and on the server side it will interprete it as XML.

NSXMLParser error, how to get rid of invalid chars inside XML tags?

Hi everyone and thanks in advance for your help.
This is the situation:
I'm consuming a webservice that returns me a soap message in the following way:
<?xml version="1.0" encoding="UTF-8"?>
<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:Body>
<getMessagesResponse xmlns="urn:DefaultNamespace">
<getMessagesReturn xmlns="">
<?xml version="1.0" encoding="ISO-8859-1" ?>
<contact>
A message with escaped values like & < >
</contact>
</getMessagesReturn>
</getMessagesResponse>
</soapenv:Body>
</soapenv:Envelope>
I use NSUTF8StringEncoding to read the getMessagesReturn child and it generates me the following:
<?xml version="1.0" encoding="ISO-8859-1">
<contact>
A message with escaped values like & < >
</contact>;
My problem is that it also unescape the & < > inside the contact tag, and of course the NSXMLParser throws an error because these are invalid characters inside a XML tag.
My Question is, How can I avoid this? Is there a way to escape back only the tags message contents before passing the info to the Parser?
Any help would be greatly appreciated.
Edit I use:
[NSString stringWithCString:(char*)elementText encoding:NSUTF8StringEncoding];
Do you control the web service? The correct way to pass getMessageReturn is with a CDATA. Otherwise, the correct encoding would be like this (note the message itself and the extra &amp's)
<getMessagesReturn xmlns="">
<?xml version="1.0" encoding="ISO-8859-1" ?>
<contact>
A message with escaped values like &amp; &lt; &gt;
</contact>
</getMessagesReturn>
But CDATA is much easier, and this is what it's for. If nothing else, you can use string substitution to insert the CDATA before parsing.

Is this a standard or common encoding for a SOAP request?

I'm using a web service where the WSDL describes a single string element in each request and response.
<s:element name="SERVICE">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="SERVICERequest" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
Embedded in that string are a number of plain XML elements that have escaped tags.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SERVICE xmlns="https://services.transcard.com/">
<SERVICERequest>
<SERVICE_REQ>
<PARAM_1>
Value1
</PARAM_1>
<PARAM_2>
Value2
</PARAM_2>
<PARAM_3>
Value3
</PARAM_3>
</SERVICE_REQ>
</SERVICERequest>
</SERVICE>
</soap:Body>
</soap:Envelope>
This is the format of responses from the service, and is the format expected for incoming requests.
Is this common in SOAP interfaces? In practice, it causes the inner parameters to be inaccessible to the SOAP library I'm using. (soap4r) Any feedback from SOAP veterans is appreciated.
No. That's not common.
That completely disregards using an actual schema (which defines the data type being returend) and replaces it with a giant string that you're going to have to parse once you get the response.
...Terrible.