How can I get current active sync properties?

This forum contains short topics that require short answers. Developers arround the world are welcomed to help the community, or to post their own questions.
[C++ development]

Moderators: Teksoft, admin

How can I get current active sync properties?

Postby swordsmile » Fri Feb 02, 2007 7:22 am

Hi All,
Now I can get sync state from HKEY_LOCAL_MACHINE\\System\\State\\Active\\Synchronizing. But how can I get the detail sync properties. For example, which type data are synchoronizing? Contact? Task? Email? Or Appointment?
swordsmile
TEK-Seeker
 
Posts: 21
Joined: Wed Dec 06, 2006 10:35 am

Postby Houser » Fri Feb 02, 2007 10:06 am

You can use the device configuration API to get sync information
from ActiveSync. You can also configure AS sync settings with
this API. Search for DMProcessConfigXML() function and the
XML syntax for this function.

Houser
Houser
TEK-Seeker
 
Posts: 17
Joined: Mon Nov 13, 2006 2:11 pm
Location: Germany

Postby swordsmile » Mon Feb 05, 2007 9:00 am

Device configuration API?
Can you give me more information? a simple sample is expected. Thank you.
swordsmile
TEK-Seeker
 
Posts: 21
Joined: Wed Dec 06, 2006 10:35 am

Postby sad_ghost » Mon Feb 05, 2007 9:14 am

Check out DMProcessConfigXML API function and there is also a full documentation on settings configurable on MSDN online help page. Also you can have a look at this article to have a first experience of how the mechanism works.
sad_ghost
TEK-Giant
TEK-Giant
 
Posts: 269
Joined: Thu Apr 06, 2006 11:04 am

Postby sad_ghost » Mon Feb 05, 2007 10:51 am

Hi, Raul
I have read your link document but still some problem I understand.
1. CFGFLAG_PROCESS- Boolean value helps to write data into the OMA DM Management tree.

CFGFLAG_METADATA- Boolean value helps to read data from the OMA DM Management tree. Is this right?

2. Can you please show an example code on how to use the DMProcessConfigXML() API with CFGFLAG_METADATA to read value?

Best wishes,
Fei



If you carefully read the SDK help :
In Windows Mobile 5.0 and later, you can call DMProcessConfigXML from within the setup DLL file of a .cab file.

The caller of DMProcessConfigXML is responsible for cleanup of the output buffer that the ppszwXMLout parameter references. Memory is allocated in the implementation by means of the new [] operator. Thus the caller must use the delete [] <varname> statement to free the output buffer.

Note If DMProcessConfigXML retrieves a document, the caller should parse the document for errors.
The Configuration Manager component is transactional and must process only one configuration request at a time to prevent collisions. Therefore, the DMProcessConfigXML function processes only one XML configuration request at a time.


So you need to fill pszWXMLin with the query XML and wait for the response in ppszwXMLout.

HRESULT hr = E_FAIL;
LPWSTR wszOutput = NULL;

// Process the XML.
hr = DMProcessConfigXML(g_wszXml, CFGFLAG_METADATA, &wszOutput);
//Process returned string -> wszOutput
// The caller must delete the XML returned from DMProcessConfigXML.
delete [] wszOutput;

You can fill g_wszXml using string.h APIs (_tcscat, etc) or read it from a file
For a complete list of how the XML should look like consult
http://msdn.microsoft.com/library/defau ... rovdtd.asp

Cheers,
Raul
sad_ghost
TEK-Giant
TEK-Giant
 
Posts: 269
Joined: Thu Apr 06, 2006 11:04 am

Postby swordsmile » Mon Feb 05, 2007 11:54 am

Hi, Raul
Thank for your quick response at first.
It seems that I can't describe my question clearly. Sorry.
My trouble is that I don't know what is the query XML, and what difference between question XML and process XML.

For example, If I have added a link to favorite. The inplut xml as following.
Code: Select all
LPCWSTR g_wszFavoriteXml =
L"   <wap-provisioningdoc> "
L"      <characteristic type=\"BrowserFavorite\"> "
L"         <characteristic type=\"MSN Search\"> "
L"            <parm name=\"URL\" value=\"http://search.msn.com/\"/> "
L"         </characteristic> "
L"      </characteristic>"
L"   </wap-provisioningdoc>";


Now I want to get this link information. I replace CFGFLAG_PROCESS to CFGFLAG_METADATA.
The problem is : How to write the query XML?
What rule with it ?

Best wishes,
Fei
swordsmile
TEK-Seeker
 
Posts: 21
Joined: Wed Dec 06, 2006 10:35 am

Postby swordsmile » Tue Feb 06, 2007 4:13 am

My query xml is following:

Code: Select all
LPCWSTR g_wszFavoriteXml =
L"<wap-provisioningdoc> "
L"   <characteristic type=\"BrowserFavorite\"> "
L"      <characteristic type=\"MSN Search\"> "
L"         <parm-query name=\"URL\"> "
L"      </characteristic> "
L"   </characteristic>"
L"</wap-provisioningdoc>";
...
hr = DMProcessConfigXML(g_wszFavoriteXml, CFGFLAG_METADATA, &wszOutput);


But the return code is 0x80042009. Why?
swordsmile
TEK-Seeker
 
Posts: 21
Joined: Wed Dec 06, 2006 10:35 am

Postby Houser » Tue Feb 06, 2007 10:01 am

Do not use the CFGFLAG_METADATA flag, use the CFGFLAG_PROCESS
flag instead then it should work.

Here is an example XML that I use for my query:

Code: Select all
const TCHAR XML_SYNC_ENABLE_QUERY[] = TEXT("<wap-provisioningdoc><characteristic type=\"Sync\">\
<characteristic type=\"Mail\">\
<parm-query name=\"Enabled\"/>\
</characteristic>\
<characteristic type=\"Calendar\">\
<parm-query name=\"Enabled\"/>\
</characteristic>\
<characteristic type=\"Contacts\">\
<parm-query name=\"Enabled\"/>\
</characteristic>\
</characteristic></wap-provisioningdoc>");


Houser
Houser
TEK-Seeker
 
Posts: 17
Joined: Mon Nov 13, 2006 2:11 pm
Location: Germany

Postby swordsmile » Tue Feb 06, 2007 10:19 am

It's helpful. Thanks a lot, houser. :lol:
swordsmile
TEK-Seeker
 
Posts: 21
Joined: Wed Dec 06, 2006 10:35 am


Return to Pocketpc

Who is online

Users browsing this forum: No registered users and 1 guest


cron