Forum Discussion
Power Automate Sharepoint file Copy not keeping the created by
- Sep 02, 2020
Ok, so I can't find anywhere that says this is possible or how to do it, but I just figured it out, at least it works for me going cross site. So the trick is to utilize the built in move to command via REST API. There is a hidden little property on it that acts like a move but retains the source since copy doesn't retain metadata but move to command will. So this seems to work, here is a Screen of my test flow. I'll also paste the Body text down below so you can copy and paste, but it's actually pretty simple once you figure out all this undocumented stuff like the Conflictname behavior which I just guessed at to find the right number to override the name. You can also change that to a 2 if you want to generate a new file for each update instead, or 0 to do nothing if one exists. Anyway hope this works for you, not sure how it'll work with files already open for editing but hopefully it still copies and doesn't error when locked for editing otherwise I don't think it'll be possible. You can get status of the job etc. to do retries if that's the case but that's outside my time to spend on this limitations :).
API: _api/site/CreateCopyJobsBody:
{
"exportObjectUris":[
"Link to Item from Get File Properties Step goes here"
],
"destinationUri":"https://Your_Tenant.sharepoint.com/sites/YourSite/YourLibrary_NoSlash_at_end",
"options":{
"IgnoreVersionHistory":true,
"IsMoveMode":true,
"MoveButKeepSource":true,
"NameConflictBehavior":1
}
}
ChrisWebbTechI had a wired issue happen today I was hoping you might have some insight on. I'm using the solution you came up in 3 power automates. 1 for what ever reason has stopped working although there are no errors in power automate and from that prospective it seems to have completed successfully but the file is not copied. More specifically it has 1/2 stopped working. I have it copy the file when it is first created then copy it when there are changes. It does copy it when it is new but will not copy the changed one, again there are no error in the flow.
I've found several articles about how to look into the rest api but I can't seem to get them working, I'm not sure I've found the right directions.
Any ideas?
Thanks
Sean
ChrisWebbTech Never mind I was able to figure out the problem. The particular library had a few extra columns. I recreated them in the library that I am coping the files to and it start working. It is weird though considering the other 2 libraries I'm coping from have extra columns that are not in the new library and it works. But maybe it is being extra picky for this library.
Thanks
Sean