A lot of questions on the MSDN forums center around how to customize a device or an app to prefer a specific network connection over another.  The correct way to accomplish this is by "provisioning" the device.  In fact a great many aspects of the device and the applications on it can be configured through 'provisioning' the device. 

Since provisioning is so broad, I've just started a tag for this topic, and I expect to post several times to this blog in the next little while on how to accomplish several common tasks through provisioning the device.  But because the topic is so broad, I want to give a brief overview of what it is, and point you to several MSDN resources that can help you get started. 

You should be warned that provisioning a device incorrectly can wreak havoc with whatever system you altered in the process.  This means your cell phone or data plan could quit working, or your data plan will become the preferred network over wi-fi and cost you lots more money, or that all your browser favorites will disappear.  In short, lots of bad things can happen so you should consider testing on a device emulator before doing anything on a physical device.

To provision a device, you send an XML document to the device via the device's DMProcessConfigXML native function or remotely from a desktop computer via the ProvisionDevice(...) method on the Microsoft.SmartDevice.Connectivity.Device managed class.  The .NET Compact Framework offers no managed wrapper to the DMProcessConfigXML function, so if you want to provision your device from an application running on the device itself you will have to P/Invoke into this function on your own.  It turns out that doing this properly is tricky and deserves a post of its own (stay tuned).  But if you're eager to get started check out the P/Invoke.Net page on the function that I recently added.

The XML document you send to the device is carefully crafted to either set or query parameters of some characteristic of the device.  These characteristics may relate to your browser favorites list, the network connections available, the proxy server(s) available for use, speed dial settings, sounds, ActiveSync, etc. etc.  The full list is available from MSDN: Configuration Service Provider Reference for Windows Mobile-Based Devices.  For the purposes of NetCF-related efforts however, on this blog I will focus primarily on the network-related configuration settings you can reach through provisioning.

In response to the XML document you send to the device, you get another XML document with the results of your query.  If you were just setting parameters, you essentially get the same XML document back.  If you were querying for existing settings, you will get an XML document similar to your request, except with all the values you requested filled in.

In a future post I'll walk through a example of creating a NetCF app that allows the user to write XML, send it to the device, and read the XML that comes back.  Subsequent posts will then describe various XML snippets that will accomplish some useful tasks.  If you want to see me cover a specific scenario and give example XML (since I personally find the MSDN docs for XML samples to be sparse at best) drop a comment below and I'll do the best I can to cover the topics.