I am trying to rename file( removing few unwanted characters adding few etc). I am able to do it via itemadded event I have tried SPFile.MoveTo( works fine) and simple changing property["Name"] it works as well.

My issue is that none of these ways are making versions, MoveTo just removes existing file and creates/moves new(tried overwrite option but didn't helped) where changing property name doesn't work if filename is already in use.

I have tried itemadding event but that doesn't work for me either. Can anyone help me with this?

  • Before I try a full reply, you claim to have already tried using itemAdding instead. What have you actually tried? I think it could work, but you would need to use the AfterProperties collection instead of accessing the ListItem instance. Have you tried something like properties.AfterProperties["Title"] = newFileTitle?
    – SPArcheon
    Commented Sep 25, 2016 at 14:38
  • No, i am using name property, internalname of "name" properties.AfterProperties["internalname oF Name"] = new filename
    – Aji
    Commented Sep 25, 2016 at 14:53

1 Answer 1


You should use .Update() or .SystemUpdate(true) in your event receiver code as both should increment the version. refer this blog

  • Yeah they both increase the version, probably you are talking about the second approach i have mentioned. If i try to rename a file and the new name is already in use it doesn't work so no versions :(.update or systemupdatedoesn't come in the picture.
    – Aji
    Commented Sep 27, 2016 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.