Search code examples
microsoft-sync-framework

filesyncprovider creates folders for documents with same name as document


I am building a sync app with a customprovider and a filesyncprovider. I based my provider on this example:

https://code.msdn.microsoft.com/File-Sync-with-Simple-c497bf87

Now I want to extend to a hierarchical folderstructure. So in the EnumerateItems method of the custom syncprovider I return all files and folders just like I did before with only the files in the directory. Now on the filesyncprovider side, this results in a creation of folders with the name of the file and the file being placed in this folder. E.g. Folder1\textfile.txt\textfile.txt

I have no idea, what I am doing wrong and I find it hard to know the part of the MS filesyncprovider where I could debug to see, what's happening.

My question is, what am I doing wrong and how can I correct it, so that the correct output would be Folder1\textfile.txt?

Best regards,

Tobias


Solution

  •  // Must return the relative path without the filename
            public string RelativeDirectoryPath
            {
                get
                {
                    return _relativeFilePath;
                }
    

    Read first - then ask: I returned the path to the file instead of the path to the folder... comment above even warns not to do that...