سؤال

I am trying to develop a client to connect to Microsoft exchange server using Activesync protocol. Now I know how to make up Activesync HTTP header and how to transfer between xml and wbxml. But I still have no idea how to generate xml string accoding to Activesync command. Here is a example: For FolderSync command, here is the xml string generate for it:

<?xml version="1.0" encoding="utf-8"?> 
<FolderSync xmlns="FolderHierarchy:">
<SyncKey>2</SyncKey>
</FolderSync>

What's the rule? Anyone can help ?

هل كانت مفيدة؟

المحلول

Here's a good explanation of the protocol sequence you need to use for syncing:

http://msdn.microsoft.com/en-us/library/ee238029%28v=EXCHG.80%29.aspx

and another, specific to folder syncing: http://msdn.microsoft.com/en-us/library/ee159766%28v=exchg.80%29.aspx

Basically, you need to send the Http/WBXML commands in a specific order, otherwise they will be rejected. So first you need to send a FolderSync command like this:

<?xml version="1.0" encoding="utf-8" ?>
<FolderSync xmlns="FolderHierarchy">
    <SyncKey>0</SyncKey>
</FolderSync>

for Exchange to return a good SyncKey. Then you parse and use this SyncKey in your next Sync or getItemEstimate commands.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top