Sharepoint online - copy files programmatically

Mauricio Poggio Veiro 301 Reputation points
2021-11-10T17:32:25.563+00:00

Hello,

I'm working wiht Sharepoint Online, trying to copy a file (and his metadata) from one site to another in the same site collection, I'm using MoveCopyUtil:

            using (SP.ClientContext lContext = ClientContextAuth(xsURLOrigen))
            {
                SP.MoveCopyOptions lOptions = new SP.MoveCopyOptions();
                lOptions.ResetAuthorAndCreatedOnCopy = false;
                SP.MoveCopyUtil.CopyFile(lContext, xsURLOrigen, xsURLDestino,true, lOptions);
                lContext.ExecuteQuery();
            }

This throw the next error: "Value does not fall within the expected range."

any help will be appreciated, thanks!
Mauricio.

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

1 answer

Sort by: Newest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.