Hi @Jyoti Rajpurohit ,
To help you better, can you share your code and error message with me?
In addition, according to my research and testing, if you want to upload files with the same name to the Document Library, you can try to select the option when you upload files with the same name: Keep both
.
My test result:
Hope it can help you. Thanks for your understanding.
-------------------------------------------------------------
Update-------------------------------------------------------------
I have reproduced your issue, When we use Overwrite:false
,we get 400 error
.
According to my research and testing, unfortunately, we cannot change the overwrite, and there are currently no APIs can avoid overwriting the files with the same name. As a workaround, if you want to upload files with the same name to the Document Library, please try the method above.
The API is upload file to SharePoint : http://xxx.sharepoint.com/sites/xxx/_api/web/GetFolderByServerRelativeUrl('sites/Library Name/Folder Name')/Files/add(url='a.txt',overwrite=true)
Thanks for your understanding.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.