msgraph-sdk-python icon indicating copy to clipboard operation
msgraph-sdk-python copied to clipboard

How to add @microsoft.graph.conflictBehavior to a PUT request?

Open samvv opened this issue 1 year ago • 2 comments

I have this piece of code:

await client.drives \
   .by_drive_id(drive_id) \
   .items \
   .by_drive_item_id(f'root:/foo/baz/bar.txt:') \
   .content \
   .put(body)

I want it to fail if the file already exists.

According to this StackOverflow answer, I have to add @microsoft.graph.conflictBehavior with a value of fail somewhere. My question is: where? There's no additional_data key where I can pass this to, like it is shown in some other examples.

samvv avatar Jan 19 '24 20:01 samvv

The conflict behaviour is set in the url.

We will need to provide a sample for python that is similar to https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/upgrade-to-v5.md#upload-a-small-file-with-conflictbehavior-set

andrueastman avatar Apr 12 '24 16:04 andrueastman

hello, any update on this ? i can't move any item using replace conflict behavior.

yeyeric avatar Oct 30 '24 10:10 yeyeric