Search code examples
c#registrycompact-frameworkwindows-ceactivesync

Is there a way to programatically disallow file syncing via ActiveSync?


Is there a way to programmatically disallow the file syncing that happens between a handheld device and PC when the user checks Mobile Device Settings > Change content sync settings > File > Sync Settings?

The registry update in the link provided by josef looks promising; if I update that setting programmatically within the app that runs on the handheld, will that prevent file syncing, or do the connected PCs also need to have their registry setting modified?


Solution

  • This updates the "GuestOnly" registry value mentioned by josef and tcarvin:

    RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows CE Services");
    if (key != null)
    {
        key.SetValue("GuestOnly", 00000001, RegistryValueKind.DWord);
    }
    

    I'm not sure this really disallows file synching, though...the jury is still out on that.

    UPDATE

    It would seem that the key (NPI) registry value that needs to be touched (in a different way than I am touched) is "ExcludeExt"; e.g., if I don't want *.lnk, *.tmp, *.cdb, *.mdb, or *.sdf files synced:

    key.SetValue("ExcludeExts", "lnk,tmp,cdb,mdb,sdf", RegistryValueKind.String);
    

    This does work - *.SDF files in the "My Documents" folder on the handheld device are no longer synced to C:\Users\clay\Documents\Documents on Clay's Device on the PC.