Question

Any event-receiver for share point library multiple document upload event? I am trying to update some information at that time of uploading multiple doc in library.I don't have any clue.

Was it helpful?

Solution

You need to catch the ItemAdded event that is triggered automatically each time you upload a file to SharePoint. There are templates for SharePoint Event Receivers within Visual Studio itself (New Project > SharePoint > Event Receivers).

The wizard will guide you through the creation of the solution - including which events you would like to handle. Once created, you will see empty event receivers in your solution where you can add the logic to do whatever you want it to do. The 'properties' object that is passed to each event receiver contains all necessary information regarding the files you've uploaded.

This link describes nicely the function of each event that document libraries fire.

If you're after a relatively in-depth guide on the subject, have a look here.

The alternative method would be to use SharePoint Designer to create a SharePoint Workflow that is triggered upon item upload - although this is probably the more straightforward method, it ultimately results in a less customisable solution.

With regards to multiple uploads at the same time, SharePoint event receivers (as far as I'm aware) are in the context of a single item (i.e. one file uploaded), so I would probably either:

  • Query the document library/database to find items with the same 'DateCreated' values
  • Use a database to keep a record of uploaded files, log the upload times and file names and then perform actions based upon matching records.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top