I wanted to move a Folder from one SharePoint site to another. So i used the MoveTo option provided inside the list views:-
the process started for around 1 hour then stop progressing, so i cancelled the process .. now on the destination i got all the Folders and sub-folders and around 3500 files. but some files are missing. so i wrote this workflow to move the remaining files to their related folders inside the destination. Where the source files were inside a library named "Marketing", inside the root Folder named "Marketing", then a sub-folder named "Archive",,, while on the destination we have the files inside a library named "Archive", then a root folder named "Archive":-
where inside the Compose i am converting the source path to the destination path:-
if(
greater(length(last(split(items('Apply_to_each')?['{Path}'], 'Marketing/Marketing/Archive/'))), 0),
concat(
'/Archive/Archive/',
if(
equals(
substring(
last(split(items('Apply_to_each')?['{Path}'], 'Marketing/Marketing/Archive/')),
sub(length(last(split(items('Apply_to_each')?['{Path}'], 'Marketing/Marketing/Archive/'))), 1),
1
),
'/'
),
substring(
last(split(items('Apply_to_each')?['{Path}'], 'Marketing/Marketing/Archive/')),
0,
sub(length(last(split(items('Apply_to_each')?['{Path}'], 'Marketing/Marketing/Archive/'))), 1)
),
last(split(items('Apply_to_each')?['{Path}'], 'Marketing/Marketing/Archive/'))
)
),
''
)
I test this on a test tenant, and the operation moved the files to their related destination folders ,, but since i want to apply this to the Prod site which failed, so generally speaking, is my approach valid?
Thanks
Hint, i used the above endpoint to do the move, and not the built-in Move File action, since the built-in "Move File" action will raise this error:-
Missing or mismatched field definition on the destination list for source field '_dlc_DocId' type 'Text'. Source site template id '7', target site template id 'SitePagePublishing'. Total blocked root objects in this operation is [1]