0
votes

I am trying to duplicate files in a document library, with a different GUID/ name in SharePoint using CSOM. This needs to copy all existing metadata.

I am currently uploading files to a document library, each file has a specific set of metadata when it gets uploaded, one of these is a GUID generated by the web application (C# / CSOM). What I need to do is when a copy button is selected in the application any associated file(s) are duplicated and given the new GUID and name, but all other information should be the same.

Thanks in advance.

1

1 Answers

0
votes

Get the list item for the file, create a new list item, iterate over the properties of the existing item and copy it to the new item, save the item and use the SaveBinaryDirect of the File object inside the List item to copy it to the new item, then update the GUID to a new one