在C#with CSOM中,如何将文件从已知位置复制到已知文件夹?
我有一个函数,它使用在C#with CSOM中,如何将文件从已知位置复制到已知文件夹?,c#,copy,sharepoint-online,csom,shared-directory,C#,Copy,Sharepoint Online,Csom,Shared Directory,我有一个函数,它使用SearchExecutorfinds查找指定文件的路径,该路径返回一个字符串,如 Documents/Forms/DispForm.aspx?ID=43 我有另一个函数,它创建并返回一个Microsoft.SharePoint.Client.Folder 给出: 文件名 文件位置,以及 文件夹 如何将文件复制到文件夹中 如果有帮助,文件夹上的ServerRelativePath已初始化为: Folder itemFolder = folderItem
SearchExecutor
finds查找指定文件的路径,该路径返回一个字符串,如
Documents/Forms/DispForm.aspx?ID=43
我有另一个函数,它创建并返回一个Microsoft.SharePoint.Client.Folder
给出:
Folder itemFolder = folderItem.Folder;
context.Load(itemFolder, folder => folder.ServerRelativePath);
context.ExecuteQuery();
return itemFolder;
您可以使用CSOM
File.CopyTo
方法或File.copytusingpath
方法将文件复制到其他位置
BR为答案干杯。CopyTo做到了这一点,尽管sharepoint.stackexchange.com上的答案(我刚刚才知道)更有用: