hi im using method for copy or move file on sharepoint CSOM. but i want to ask how to implement when it's duplicated it automatically replace and update version?
i have been try with this function but it's always
"Message": "An error has occurred.",
"ExceptionMessage": "The destination file already exists.",
"ExceptionType": "Microsoft.SharePoint.Client.ServerException",
"StackTrace": " at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)\r\n at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()\r\n at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)\r\n at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()\r\n at SRSHostedApp.Services.SharePointOnPremises.MoveFile(String SrcUrl, String DestUrl) in C:\\smart_registry_system\\sharepoint-integration\\SRSHostedApp\\SRSHostedApp\\Services\\SharePointOnPremises.cs:line 671\r\n at SRSHostedApp.Controllers.FoldersController.MoveItem(MoveModel moves) in C:\\smart_registry_system\\sharepoint-integration\\SRSHostedApp\\SRSHostedApp\\Controllers\\FoldersController.cs:line 167\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"
this is my function
public void CopyFile(string SrcUrl, string DestUrl)
{
MoveCopyOptions option = new MoveCopyOptions();
option.KeepBoth = false;
MoveCopyUtil.CopyFile(this.clientContext,SrcUrl,DestUrl,true,option);
this.clientContext.ExecuteQuery();
}
and my src url
http://*********:55555/sites/srsrms/SRS%20Documents/Finance/fredytest/License%20Management.csv
and dst url
http://********:55555/sites/srsrms/SRS%20Documents/Finance/paidi/Finance%20Folder/License%20Management.csv