5

I've only recently noticed the Filter element in the definition file for a SharePoint event receiver:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers>
    <Receiver>
      ...
      <Filter />
    </Receiver>
  </Receivers>
</Elements>

The MSDN documentation for the SPEventReceiverDefinition.Filter property says that the value: "represents the filter for the SPListItem object". And includes the following remarks:

"Event handlers are registered at the site or site collection level to implement filtering to respond to list item events. Filtering allows multiple rules to be applied in sequence to limit the size of a list or some other dimension of that list. They are specified in persistent storage as name-value pairs in the form of assignment statements."

My question is: how can I set the value of the Filter? Would you use a CAML <Where> element?

I'm just curious at this stage. I don't have a reason to use this, but saw it and starting wondering. I searched through all event receiver definitions in SharePoint 12 'hive' folders and none had a filter applied.

dariom
  • 4,413
  • 28
  • 42

1 Answers1

2

Any filtering that I have done in event receivers, I have done in code.

I found a couple of liks that seem to indicate that the filter element is either reserved, or not implemented.

http://msdn.microsoft.com/en-us/library/dd340827(PROT.13).aspx

Maybe in MOSS 2010.

Rhys Jones
  • 3,833
  • 3
  • 21
  • 17
  • There is http://msdn.microsoft.com/en-us/library/ms460929.aspx also. (I can only post one link at a time with my rep :) ) – Rhys Jones Jul 01 '09 at 11:49
  • Thanks for the links. Interesting. It wouldn't be the first time that the SDK documentation contradicts itself and isn't clear :-) – dariom Jul 01 '09 at 13:51
  • I would be very curious to see an example of filtering in code, actually. I mean, using the Filter property that you set in code using the SPEventReceiverDefintion. Do you think you can show one? :) – Philippe Sep 10 '10 at 16:00