Sudheer Madduru on Mon, 11 Jun 2018 14:49:01
I am trying to change URL while uploading document to SharePoint document library using CSOM.
We have 'XYZ' document library with following folder structure:
1. Folder 1
- Subfolder 1
- All Documents
Now, I am trying to upload document at ‘Folder 1’ and after Drag and Drop document is getting uploaded to ‘Folder 1’. What I want to do here is, Whenever user try to upload document in ‘Folder 1’, it should get uploaded to ‘Subfolder 1 ‘. Is there any way to change URL of document in CSOM while its getting uploaded. So that it will get uploaded to 'Subfolder 1' even though user is doing Drag&Drop to 'Folder 1'.
I am getting current folder URL in state.Status= Uploading event. I want to update this URL by adding 'Subfolder 1' to currentURL , so that it will upload this document direct to updated URL.
Note: If you have any other way to do it please let me know. I want to do this using CSOM.
Thanks & Regards, Sudheer
Lee__li on Tue, 12 Jun 2018 03:08:51
You could create a workflow for this library and then update the item Path and Name property.
Here is sample test case.
You could add condition to check file url based on Server Relative URL property.