2

There's a major and minor versioned document library. Users may upload file with the same name existing in the document library, so it takes another minor version. Or users may edit the item in the document library by only changing item fields without uploading a file, so it takes another minor version as well.

I need to understand if user operation is a file upload? I use itemupdated event handling method. But I do not know where to control to understand whether it is a file upload or item editing?

Please help,

Thanks

1
  • Did you find a solution to this? I am having an issue determining if the file is being edited from an upload. I need to prevent duplicate names and don't have control over the library settings. I have a requirement to have an event reciever validate that it doesn't already exist.
    – user957863
    Feb 15, 2013 at 20:52

2 Answers 2

1

It all depends on your versioning settings for the library and the options user chooses when it uploads:

  • Versionining minor and major means every upload for a file with the same name becomes indeed a new version with every upload. A file upload indeed triggers multiple events, but you could account for a ItemAdded and ItemUpdated via a global variable and a Syncronous event (very important because otherwise). The issue is that you also you have the Properties dialog that shows between operations. I would strongly suggest you read this around the same subject

http://hristopavlov.wordpress.com/2009/02/24/understanding-sharepoint-event-receivers/

  • User could choose to rename file if it exists in the upload dialog if versioning is not enabled. Also be aware that WebDav uploads via Explorer could impact you handler.
1
  • I tried to make Synchronization is Synchnronous for both ItemAdded and ItemUpdated. But a new version file upload does not trigger ItemAdded event. ItemAdded is called when only the first version file upload. So I cannot catch and carry the information(file upload) in a global variable. Also what do you mean by Properties dialog? Thanks
    – user10606
    Sep 10, 2012 at 9:50
0

I tried to make Synchronization is Synchnronous for both ItemAdded and ItemUpdated. But a new version file upload does not trigger ItemAdded event. ItemAdded is called when only the first version file upload. So I cannot catch and carry the information(file upload) in a global variable.

Also what do you mean by Properties dialog?

Thanks

Your Answer

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

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