Muh*_*han 6 .net sharepoint moss event-receiver
我们可以编写一个在更新任何列表时被触发的事件接收器.我们必须为eventreceiver指定的listtemplateid使我们的代码特定于一种列表.如果我们想要在所有站点列表上执行事件代码,该怎么办?
我有同样的要求.
也许可以将事件接收器附加到系统ContentType(所有内容类型都继承那个,ID为0x)
我会通过使用FeatureReceiver创建一个功能并以编程方式将其添加到系统内容类型来检查是否可行.这里有一些细节.
好吧,我用控制台应用程序做了一些测试.
EventReceiver 到系统(0x).调用方法ContentType.Update(true,false),它更新所有子元素 - 系统也没有ContentType更新,也没有更新子元素.事实证明,您无法使用ReadOnly|| 修改这些contentTypes Sealed属性设置为TRUEContentType.从这里看,所有ContentTypes仍然继承自那个(参见ContentType层次结构).可能存在从System继承的自定义部署内容类型,但不包含在GUI中创建的内容类型.更新此内容类型真正更新了所有子项ContentTypes(除了那些ReadOnly或所有内容类型Sealed)所以一个可行的解决方案看起来像这样:
Readonly或Sealed为false EventReceivers.EventReceiver到列表中的现有内容类型(SPList.ContentTypes)SPWeb.ContentTypesID为0x01的ContentType(),以便新列表自动添加EventReceiver.新创建的内容类型也将继承EventReceivers.所有子网站ContentTypes都继承了EventReceivers.所有这三个步骤都可以是控制台应用程序或PowerShell脚本.或者网站集广泛的功能FeatureReceiver
PS C:\Documents and Settings\Administrator> $web.contentTypes |ft id, name, EventReceivers, readonly, sealed
Id Name EventReceivers ReadOnly Sealed
-- ---- -------------- -------- ------
0x Sist?ma {} False True
0x007F1DD730DB144C84... Darba k?rt?bas v?sture {} True True
0x01 Ieraksts {, , , ...} False False
0x01003420C661289843... Darba k?rt?bas ieraksts {, , , ...} False False
0x0101 Dokuments {, , , ...} False False
0x010100629D00608F81... Office datu savienoj... {} True False
0x010100B4CBD48E029A... Univers?lais datu sa... {} True False
0x010101 Veidlapa {, , , ...} False False
0x010102 Att?ls {, , , ...} False False
0x010104 Nezin?ms dokumenta tips {} True False
0x010105 Lapu šablons {, , , ...} False False
0x010107 Lietot?ja darbpl?sma... {, , , ...} False False
0x010108 Wiki lapa {, , , ...} False False
0x010109 Pamatlapa {, , , ...} False False
0x01010901 Web da?u lapa {, , , ...} False False
0x01010A Saist?t ar dokumentu {, , , ...} False False
0x01010B Dublinas pamata kolo... {, , , ...} False False
0x0102 Notikums {, , , ...} False False
0x0103 Diskut?jamais jaut?jums {, , , ...} False False
0x0104 Pazi?ojums {, , , ...} False False
0x0105 Saite {, , , ...} False False
0x0106 Kontaktpersona {, , , ...} False False
0x0107 Zi?ojums {, , , ...} False False
0x0108 Uzdevums {, , , ...} False False
0x0108007122AD6D76CD... Darba k?rt?bas uzdevums {, , , ...} False False
0x010801 Darbpl?smas uzdevums {, , , ...} False False
0x010802 Administrat?vs uzdevums {, , , ...} False False
0x0109 Darbpl?smas v?sture {, , , ...} False False
0x010A Person {, , , ...} False False
0x010B SharePointGroup {, , , ...} False False
0x010C DomainGroup {, , , ...} False False
0x0110 Zi?a {, , , ...} False False
0x0111 Koment?rs {, , , ...} False False
0x0116 T?lo Austrumu l?gums {, , , ...} False False
0x0120 Mape {} False True
0x012001 RootOfList {} False True
0x012002 Diskusija {, , , ...} False False
Run Code Online (Sandbox Code Playgroud)
抱歉,我的WSS已本地化,但{,,, ...}表示我在内容类型中添加了几个事件接收器.正如您所见,具有Readonly或Sealed属性False的那些未被触及.
| 归档时间: |
|
| 查看次数: |
3132 次 |
| 最近记录: |