Application has problems renaming/modifying files on OneDrive and produce "We couldn't merge the changes..."

Mark Winney 0 Reputation points


FYI - none of what is happening below is a problem with the regular file system.

We have an application that is storing a set of text files (YAML) to a subdirectory of Documents, which is mapped to OneDrive.

Lets call this subdirectory "Library1" and it contains YAML files such as "Library1.yaml".

This YAML file also contains text referencing "Library1".

We have ability to rename this library from within the application. If I rename "Library1" to "Library2" the code performs the following steps:

Rename the Library1 folder to Library2

Update Library2/Library1.yaml file content to "Library2"

Rename the Library2/Library1.yaml to Library2/Library2.yaml.

Problem is when the sync process executes it produces an error dialog "You now have two copies of a file...We couldn't merge the changes in "XXXXX' so we created another copy of it."

We end up with 2 files, Library2.yaml and Library2-ABC.yaml

Library2.yaml does not contains the changes and Library2-ABC.yaml contains the all the correct changes.

My assumption is that changing the file content and also renaming the file is causing OneDrive problems merging the is seeing conflicts perhaps.

I did try the "Always keep on the device" option on the parent folder and this did not help.

I assume disabling the sync for the Library folder is another option...but I cannot see any ability to do this when creating a folder from within the code.

I cannot see anyway around this problem, code-wise, without doing the file/folder operations outside OneDrive (such as a temporary directory) and then copying the folder back to OneDrive.

Any alternative suggestions would be appreciated. Thanks

A Microsoft file hosting and synchronization service.
609 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,319 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,764 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emi Zhang-MSFT 19,046 Reputation points Microsoft Vendor


    Did you check the permission of the user modify, write and delete for the folder?

    Did you open it from web or local OneDrive folder?

    Try to create a admin profile and check if this problem still exists.

    Please provide more information about the problem and you can try to upload a screenshot so that I can get more accurate solutions to this problem. I’m glad to help and follow up your reply.

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments