Device provisioning with XML [UPDATE]

I was talking to Rick Engle from Microsoft this evening about the DMProcessConfig managed wrapper code I posted before. He needed to get the results of a param-query out from the function into managed code and the previous code I posted doesn’t cut it. This code will pull the string return value out and hand it back to the caller rather than just destroy the buffer.


(Disclaimer applies)


unsafe static public string ProcessXMLWithResults(string Filename)


      string results = string.Empty;

      StreamReader sr = new StreamReader(Filename, Encoding.ASCII);

      string XML = sr.ReadToEnd(); 

// Test string: "<wap-provisioningdoc> <characteristic type=\"SecurityPolicy\"><parm-query name=\"4111\" /> <parm-query name=\"4112\" /> <parm-query name=\"4113\" /> <parm-query name=\"4115\" /> <parm-query name=\"4119\" /> <parm-query name=\"4120\" /> </characteristic></wap-provisioningdoc>";

      fixed (int * OutPtr = new int[1])


            IntPtr outptr = (IntPtr)OutPtr;



                  int result = DMProcessConfigXML(XML, 1,outptr);

                  if (result !=0)






                        char *outbuffer = (char *)*OutPtr;

                        StringBuilder sb = new StringBuilder();

                        for (int count=0;outbuffer[count] != '\0';count++)




                        results = sb.ToString();




            catch(Exception e)





      return results;




Comments (1)

  1. Kashif says:

    Hi ,

    Can you help me with how to return a value from a query using DMProcessConfigXML…

    I have an XML like this :


     <characteristic type="EMAIL2">

       <characteristic type="{D671C70B-8EE3-4881-8045-2AEE6F731B55}">

     <parm-query name = "SERVICETYPE"/>




    I am getting HRESULT result = S_OK.

    But actually i want to retrieve the value of SERVICETYPE for an account with the above GUID.

    IS there anyway to check the account existence in MAPI using SERVICETYPE???

    Any help is appreciated!

Skip to main content