Monitoring multiple folders in one 'syncFolderItems' operation? - soap

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

Related

Extended property in EWS

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

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.

nsdata to nsstring to nsdata

I am calling the web services. The web service returns data in xml format. Now the problem is the xml data is not being received in proper format. In place of "<", ">" it returns in html form.
So I assigned the xmldata to a NsMutableString and replaced the escape characters so that the format of xml data is proper. Then I reassigned the NSMutableString to NSData so that I can parse the tags. but the problem is the xmlparser stops right where the xml data is, where I replaced the tags. It doesn't go further. What is going on?
This is the xml response from web service that I called.
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:GetCustomerInfoResponse xmlns:ns1="http://aa.somewebservice.com/phpwebservice">
<return xsi:type="xsd:string">
<?xml version="1.0" encoding="utf-8"?><customer><id>1</id><customername>Hitesh</customername><phonenumber>98989898</phonenumber></customer>
</return>
</ns1:GetCustomerInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And this is after I replaced the tags.
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:GetCustomerInfoResponse xmlns:ns1="http://aa.somewebservice.com/phpwebservice">
<return xsi:type="xsd:string">
<?xml version="1.0" encoding="utf-8"?>
<customer><id>1</id><customername>Hitesh</customername><phonenumber>98989898</phonenumber></customer>
</return>
</ns1:GetCustomerInfoResponse>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
Now the problem is while parsing the xml data, the parser only goes up to return tag. And then it is stuck there.
What parser do you use? On the iPhone you can use different parsers (eg: TouchXML or TinyXML), try to use they...
Also I think you would remove <?xml version="1.0" encoding="utf-8"?> from 'return' tag or replace it with another tag. Then when needed make the inverse transformation.

XSL Transform - Remove Parent Node

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com">
<soapenv:Body>
<upsertResponse>
<result>
<created>true</created>
<id>0011</id>
<success>true</success>
</result>
<result>
<created>false</created>
<id>0012</id>
<success>true</success>
</result>
</upsertResponse>
</soapenv:Body>
</soapenv:Envelope>
**How can I transform this to**
<upsertResponse>
<result>
<created>true</created>
<id>0011</id>
<success>true</success>
</result>
<result>
<created>false</created>
<id>0012</id>
<success>true</success>
</result>
</upsertResponse>
This is an example of XSL that takes the first child of first child of root and makes it root node of new XML:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:copy-of select="./*[1]/*[1]/*[1]" />
</xsl:template>
</xsl:stylesheet>
Please note that you can take only one node and not multiple nodes since placing few nodes as root of XML is not valid.
Use an <xsl:match> to select the <upsertResponse> element, then put an <xsl:copy> inside of it. That should do the trick. Sorry I don't have the exact syntax, but hopefully this points you in the right direction.