You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of IFile.MoveToAsync() and IFile.MoveToBatchAsync() is calling a private method:
private ApiCall GetMoveToApiCall(string destinationUrl, MoveOperations moveOperations, MoveCopyOptions options)
{
// If same site
if (UrlUtility.IsSameSite(PnPContext.Uri, destinationUrl))
{
return GetMoveToSameSiteApiCall(destinationUrl, moveOperations);
}
else
{
bool overwrite = moveOperations.HasFlag(MoveOperations.Overwrite);
options ??= new MoveCopyOptions() { KeepBoth = !overwrite };
return GetMoveToCrossSiteApiCall(destinationUrl, overwrite, options);
}
}
The issue is that it takes the optional MoveCopyOptions parameter into account only when the moving is done from one site to a different one: UrlUtility.IsSameSite() == false.
I was specifying the MoveCopyOptions.KeepBoth = true moving files on same SharePoint site, and it was ignored, overriding the file if it was already there.
Describe the solution you'd like
If it's possible to add the MoveCopyOptions parameter to GetMoveToSameSiteApiCall() and use it so we can keep both files when moving them across same site (preferably).
Another way for this could be to add separate IFile.MoveToAsync() and IFile.MoveToBatchAsync() for internal and external operations:
As a side note, you can keep both files on same site calling IFile.MoveToBatchAsync(destinationUrl, MoveOperations.Overwrite | MoveOperations.None). In this case MoveOperations.Overwrite | MoveOperations.None behaves like MoveCopyOptions.KeepBoth, but not sure what will happen when you'll add other MoveOperations flags.
@IllBarto : Now most move operations use the same API (the cross site one) and solving your need of KeepBoth when the target already exists. Only when the MoveOperations.AllowBrokenThickets or MoveOperations.BypassApprovePermission are used the "old" API is used. Closing this one, please open a new issue if things are not working as expected.
Category
Describe the feature
The implementation of
IFile.MoveToAsync()
andIFile.MoveToBatchAsync()
is calling a private method:The issue is that it takes the optional
MoveCopyOptions
parameter into account only when the moving is done from one site to a different one:UrlUtility.IsSameSite() == false
.I was specifying the
MoveCopyOptions.KeepBoth = true
moving files on same SharePoint site, and it was ignored, overriding the file if it was already there.Describe the solution you'd like
If it's possible to add the
MoveCopyOptions
parameter toGetMoveToSameSiteApiCall()
and use it so we can keep both files when moving them across same site (preferably).Another way for this could be to add separate
IFile.MoveToAsync()
andIFile.MoveToBatchAsync()
for internal and external operations:The text was updated successfully, but these errors were encountered: