by Bar Zohan
16. April 2010 23:55
Here you can download the OpenNETCF Desktop Communication Library which includes all necessary classes to use activesync to connect and transfer files to/from a mobile device.
Add the project to your solution. Add a reference to the OpenNETCF Project you've just added inside the project you want to communicate with a mobile device.
Here is the code for connecting to a mobile device thru ActiveSync and transfer files.
using OpenNETCF.Desktop.Communication;
using (RAPI rapi = new RAPI())
{
rapi.Connect(true);
//transfer direction: device to pc
rapi.CopyFileFromDevice(@"c:\test.txt", @"\test.txt", true);
//transfer direction: pc to device
rapi.CopyFileToDevice(@"c:\test.txt", @"\test.txt", true);
}