Skip to content

@microsoft.graph.conflictBehavior in driveitem copy #981

Closed

Description

@indigane

Category

  • Question
  • Documentation issue
  • Bug

Expected or Desired Behavior

Copying a driveitem allows for defining @microsoft.graph.conflictBehavior to handle conflicts, as per design according to issue #759

This should also be documented.

Observed Behavior

Conflicts cause 409 Conflict response despite @microsoft.graph.conflictBehavior.

{
  "error": {
    "code": "nameAlreadyExists",
    "message": "The specified item name already exists.",
    "innerError": {
      "request-id": "{requestId}",
      "date": "{date}"
    }
  }
}

Steps to Reproduce

POST https://graph.microsoft.com/v1.0/users/{username}/drive/items/{itemId}/copy

{
  "parentReference": {
    "driveId": "{driveId}",
    "id": "{parentItemId}"
  },
  "name": "foo",
  "@microsoft.graph.conflictBehavior": "rename"
}

^ Making this request twice will cause 409 Conflict nameAlreadyExists on the second try.

Activity

  1. changed the title [-]`@microsoft.graph.conflictBehavior` in file copy[/-] [+]`@microsoft.graph.conflictBehavior` in driveitem copy[/+] on Jan 15, 2019
  2. Herz3h commented on Aug 8, 2019

    @Herz3h

    I'm trying this aswell using the Graph API and it always returns nameAlreadyExists regardless of the behaviorConflict specified

    {
      "parentReference": {
        "driveId": "{driveId}",
        "id": "{parentItemId}"
      },
      "name": "test",
      "@microsoft.graph.conflictBehavior": "rename"
    }
    

    How to work around this ??

  3. 8ggmaker commented on Sep 1, 2019

    @8ggmaker

    any updates?

  4. kostenickj commented on Apr 7, 2020

    @kostenickj

    come on guys?

  5. greenygh0st commented on Jun 10, 2020

    @greenygh0st

    I can also confirm that this still does not function properly.

  6. marcogiannetta commented on Nov 16, 2020

    @marcogiannetta

    Adding @microsoft.graph.conflictBehavior=rename to query string parameters did work for me

  7. tofu-1 commented on Dec 8, 2020

    @tofu-1

    as marcogiannetta said, you have to add to the query params.

    Example:
    https://graph.microsoft.com/v1.0/me/drive/items/{your-file-id}/[email protected]=rename

    If you're using the C# Graph SDK you have to send a query option on the request.

    List<QueryOption> options = new List<QueryOption>
    {
        new QueryOption("@microsoft.graph.conflictBehavior", "rename")
    };
    

    Source: https://stackoverflow.com/a/44991860/14457092

  8. Herz3h commented on Dec 8, 2020

    @Herz3h

    Well docs should be updated then

  9. Cnly commented on Jan 5, 2021

    @Cnly

    It looks like the workaround above only works for OneDrive for Business... OneDrive Personal still seems to ignore it.

  10. Herz3h commented on Mar 19, 2021

    @Herz3h

    Adding @microsoft.graph.conflictBehavior to query string doesn't work either:

    https://graph.microsoft.com/v1.0/me/drive/items/{your-file-id}/[email protected]=replace

    Edit: It actually works, my bad. I just had different unrelated error (overwrite is not supported for folders)

  11. czernas commented on Mar 25, 2021

    @czernas

    Does not work with the personal accounts. 😒

  12. patrick-rodgers commented on Feb 17, 2023

    @patrick-rodgers
    Contributor

    As part of a repository clean up effort we are closing older issues. If this issue remains, please: open a new issue, reference this issue, and provide any additional details that may help in resolution. Thank you for your understanding as we work to improve our responsiveness.

  13. locked as resolved and limited conversation to collaborators on Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions