Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (fileAlreadyExists)
- {
- if (!fileCreationInfo.Overwrite)
- {
- // The existing file will be archived before being replaced by the new one
- var destinationFileName = string.Format(
- "{0} ({1}){2}",
- Path.GetFileNameWithoutExtension(ensuredFile.Name),
- DateTime.UtcNow.ToString("yyyy-MM-dd hh-mm-ss"),
- Path.GetExtension(ensuredFile.Name));
- var destinationurl = string.Format("{0}/{1}", parentFolder.ServerRelativeUrl, destinationFileName);
- ensuredFile.MoveTo(destinationurl, MoveOperations.None);
- clientContext.ExecuteQuery();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement