locked
How to detect an Eventreceiver execute for in one item process or in multiple items process RRS feed

  • Question

  • Hello,

    I have picture library and I register an ItemAdded eventreceiver to this library .

    I have an issue like that, if only a picture (item) is added to library with select browse button (mean only one item upload) , I want to add a log record ("a picture was added to library" ) to sql Db  .

    On the other hand  , if multiple items upload link click and picture are uploaded to library...
     I want to add log record ("more than picture were added to library") to sql Db ,
    To do this issue , I must detect that EventReceiver start to fire for one item or for multiple items.

    Do you have any opinion ?

    Thanks,

    Thursday, September 6, 2012 4:06 PM

Answers

  • Event receivers are always in the context of an individual item so there is no way to notice from inside the event receiver that it was one of several files being uploaded.

    Paul Stork SharePoint Server
    MVP Senior Solutions Architect: BlueChip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

    • Marked as answer by gezzgin Friday, September 7, 2012 6:50 AM
    Thursday, September 6, 2012 4:37 PM

All replies

  • Event receivers are always in the context of an individual item so there is no way to notice from inside the event receiver that it was one of several files being uploaded.

    Paul Stork SharePoint Server
    MVP Senior Solutions Architect: BlueChip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

    • Marked as answer by gezzgin Friday, September 7, 2012 6:50 AM
    Thursday, September 6, 2012 4:37 PM
  • Hi Paul,

    I wanted to be sure about this eventreceiver desing..

    Thanks for your reply.

    Friday, September 7, 2012 6:53 AM
  • Hi,

    I don't have a straight away answer for this. Probably what you can do is to have your custom upload.aspx for the particular library, on uploading update the library with a column saying is it a multiple/single file upload and from event receiver you can read the updated column. To write your custom upload.aspx for library refer this,

    http://social.msdn.microsoft.com/Forums/en/sharepointcustomization/thread/c603c25a-729b-4038-908d-3e8d8b5dfc39


    knowledge glows

    Friday, September 7, 2012 9:24 AM