共用方式為


How to enable document library event handlers for the newly created document libraries at the list definition level

The List definition files can be configured in such a way that the event handler configured automatically for the newly created document libraries. Here I provide the details of how to do it.

  • Open the Site definition folder. If you use default Site definition, STS, then open the folder from the following location.

“C:\program files\common files\Microsoft Shared\web server extensions\60\template\1033\STS

Note: Modifying the default files is not supported by Microsoft. Microsoft recommends using custom Site Definition.

  • Open the List Definition folder. If you use default list definition for document library, then open the “DOCLIB” folder in the LISTS folder

  • Open the “SCHEMA.XML” file in notepad or visual studio

  • Modify the LIST node by adding the EventSingAssembly, EventSinkClass, and EventSinkData

<List xmlns:ows="Microsoft SharePoint" Name="CustomDocuments" Title="Custom Shared Documents" Direction="0" Url="Custom Shared Documents" BaseType="1" EventSinkAssembly="TestEventHandler, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=614ce6399d917f80" EventSinkClass="TestEventHandler.MyEventHandler" EventSinkData = "">

Note:Here I hardcoded the EventSinkAssembly for sample. Could you please change it according to your component.

  • Restart IIS.

After configuring the details, if you create new document library based on the list definition, then the document library event handler will be automatically configured.

Comments