Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. if (fileAlreadyExists)
  2. {
  3. if (!fileCreationInfo.Overwrite)
  4. {
  5. // The existing file will be archived before being replaced by the new one
  6. var destinationFileName = string.Format(
  7. "{0} ({1}){2}",
  8. Path.GetFileNameWithoutExtension(ensuredFile.Name),
  9. DateTime.UtcNow.ToString("yyyy-MM-dd hh-mm-ss"),
  10. Path.GetExtension(ensuredFile.Name));
  11.  
  12. var destinationurl = string.Format("{0}/{1}", parentFolder.ServerRelativeUrl, destinationFileName);
  13. ensuredFile.MoveTo(destinationurl, MoveOperations.None);
  14. clientContext.ExecuteQuery();
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement