Here's what I'm trying to do. I'm adding an event receiver on my pictures library such that when something gets uploaded, the image gets resized.

I've got the code working fine for this. However, there is the additional requirement of resizing based on another column in the library. If the Image Size column is set to small, for example, the image is scaled smaller, etc.

Because this is a library instead of a list, adding an item actually triggers both itemAdded (after the file is uploaded) and itemUpdated (after the file's metadata has been added). I only want the resize functionality to occur when the item has been initially added though and not when the item gets edited any other time later on.

Is there a way to do this? To have the resize function run only when the file has been added initially and after the metadata for its size has been populated?

1 Answer 1


Turn on versioning for the library. Check the image's version in your ItemUpdated event receiver. If it's version 1, run your code. If not, skip the code.

if (listItem["_UIVersionString"].ToString() == "1.0")
      //do it!

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.