機能の一部として、いくつかのサイト列/コンテンツ タイプとリスト定義を作成しました。コンテンツ タイプにイベントレシーバーをアタッチしたい。イベント レシーバーをコンテンツ タイプにアタッチするコードを追加しました。spmanager を使用すると、イベント レシーバーがコンテンツ タイプに関連付けられていることがわかりますが、コンテンツ タイプからリストを作成すると、イベント レシーバーがありません。何か案は。私のコードは以下です
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
string asmName = System.Reflection.Assembly.GetExecutingAssembly().FullName;
string itemReceiverName = "xxxxxx.Intranet.SP.xxxxx.PermissionsUpdaterEventReceiver";
////surely a better way to get all lists than this
////re - do
using (SPSite thisSite = (SPSite)properties.Feature.Parent) {
using (SPWeb web = thisSite.RootWeb) {
SPContentType RambollNewsContentType = web.ContentTypes["RambollNewsContentType"];
RambollNewsContentType.EventReceivers.Add(SPEventReceiverType.ItemAdded, asmName, itemReceiverName);
RambollNewsContentType.Update(true);
}
}
}