Eric's Blog

有需求才有进步

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

刚看了Event Handler的MSND上的WEBCAST。似乎是理清楚了注册DLL的方法了。
一共有三种:

--The Wss V2 way (Only for document libraries) // 仅对文档库,可以高级设置里加入DLL信息

--Programmatically via the object model  //通过Console application/windows application注册DLL,
  // 删除注册//for    (int i=event.EventReceiver.Count-1;i>=0;i++){event.EventReceiver[i].Delete();}
  //        SPSite site = new SPSite(site);SPWeb web = site.OpenWeb(web);SPList list = web.Lists[listname];
 //         list.EventReceiver.add(SPEventReceiverType.Type,assembley,class);
    

--Using the new WSS feature framework //通过v3的feature功能,使用Caml语言写XML

/*
Feature.xml
<Feature Scope = "Web" Title = "Title of Event Handler" ID = "New Guid"
              xmlns = "http://schemas.microsoft.com/sharepoint">
    <ElementManifests>
            <ElementManifest Location="Feature Definition File"/>
    </ElementManifests>
</Feature>
Feature Definition File.xml
<Elements>
    <Receivers ListTemplateOwner = "GUID" ListTemplate="ID">
        <Receiver>
            <Name>name of event handler</Name>
            <Type>type</Type>
            <SequenceNumber>sequence</SequenceNumber>
            <Assembly>strong name of the assembly</Assembly>
            <Class>full qualified name of class</Class>
            <Data></Data>
            <Filter></Filter>
        <Receiver>
    </Receivers>
</Elements>
Setup Custom Feature
Stsadm.exe -o installfeature -filename MyFeature\feature.xml
Stsadm.exe -o activefeature -filename MyFeature\feature.xml
*/

最后提醒一下自己,每次有更改Event Handler必需IISRESET才可生效。。。
完全实例链接:http://www.cnblogs.com/chairongzhen/articles/1064209.html

posted on 2008-02-04 10:44  Eric.Chai  阅读(558)  评论(0编辑  收藏  举报