In the last post we saw the new My Extensions template which adds access to new Visual Basic features. In this post we will look at another new item introduced with Mobile In The Hand 4.0 – Provisioning XML. Visual Studio has a rich XML Editor built in, Windows Mobile uses provisioning XML documents for everything from adding a browser favourite through to configuring a new GPRS network. The new template allows you to quickly create an empty Provisioning XML document and includes the schema to ensure your document is valid. Let Visual Studio’s Intellisense help you quickly build a provisioning document. As with the Visual Basic example you start with an existing device project, in this case it can be either C# or Visual Basic. Select Add New Item and choose Provisioning XML from the list:- In this example I have called the file AddFavourite.xml (no prizes for guessing what task we will be performing). The document is created with a skeleton provisioning document. Notice the namespace is provided which links to the schema we installed for you. You can now add the required code between the wap-provisioningdoc tags. As you start to type the IntelliSense will suggest valid elements for you based on the schema:- This makes it very easy to quickly build up a complete document:- You can process a configuration document like this using the ConfigurationManager class. By setting the document as an embedded resource you can use the following code to load it and pass it to the ConfigurationManager:-
Dim xd As New System.Xml.XmlDocument xd.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualBasicDeviceProject.AddFavourite.xml")) InTheHand.WindowsMobile.Configuration.ConfigurationManager.ProcessConfiguration(xd, False)
After running this code you can check your Internet Explorer Mobile favourites:- For more information about the library see the product page.