C# – how to transfer file from PC to Windows-mobile and from Windows-mobile to PC

cweb serviceswindows-mobile

i need to transfer Text.txt file from PC (using WebService)

to Windows-mobile 5.0 – and from Windows-mobile to PC

can i get any sample code in C# for the WebService and the Windows-mobile ?

thanks in advance

Best Answer

You cannot directly transfer files. you should try ActiveSync RAPI to send information.

Use OpenNETCF. It's a useful compact framework for WindowsMobile (.NET).

Try this:

    string fileToSendToDevice = @"C:\Text.txt";

    OpenNETCF.Desktop.Communication.RAPI rApi = new OpenNETCF.Desktop.Communication.RAPI();

    if (!rApi.DevicePresent) return; // no active sync
    if (!rApi.Connected) rApi.Connect();

    if (!File.Exists(fileToSendToDevice)) return; // file not found

    rApi.CopyFileToDevice(fileToSendToDevice,
        Path.Combine(@"\My Documents\", Path.GetFileName(fileToSendToDevice)));