Welcome to MSDN Blogs Sign in | Join | Help

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;

            try

            {

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

                  if (result !=0)

                  {

                        MessageBox.Show("Failed");

                  }

                  else

                  {

                        char *outbuffer = (char *)*OutPtr;

                        StringBuilder sb = new StringBuilder();

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

                        {

                              sb.Append(outbuffer[count]);

                        }

                        results = sb.ToString();

                        free(*OutPtr);

                  }

            }

            catch(Exception e)

            {

                  MessageBox.Show(e.Message);

            }

      }

      return results;

}

 

Marcus

Published Wednesday, February 16, 2005 9:02 PM by marcpe

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Device provisioning with XML [UPDATE]

Hi ,

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

I have an XML like this :

<wap-provisioningdoc>

 <characteristic type="EMAIL2">

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

 <parm-query name = \"SERVICETYPE\"/>

</characteristic>

</characteristic>

</wap-provisioningdoc>

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!

Wednesday, February 28, 2007 3:18 PM by Kashif

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker