シンプルなイベントレシーバを使用しているため、デプロイメントステップでエラーが発生しました。私の実装クラスのインスタンスを取得するためにサービスロケータを使用するコンストラクタを削除すると、うまく動作します。ここ Sharepointイベントレシーバをデプロイするときに「オブジェクトの現在の状態のため操作が無効です」
private INotificationService iNotificationService;
public CongeER()
{
SPSite currentSite = SPContext.Current.Site;
IServiceLocator locator = SharePointServiceLocator.GetCurrent(currentSite);
try
{
iNotificationService = locator.GetInstance<INotificationService>();
}
catch (System.Exception ex)
{
System.Console.WriteLine(ex.Message);
}
}
public override void ItemAdded(SPItemEventProperties properties)
{
iNotificationService.NotifyByMail();
base.ItemAdded(properties);
}
は私のスタックトレースです:
私のコードは次のようなものである
Feature Activation: Threw an exception, attempting to roll back.
Exception: System.InvalidOperationException:
L'opération n'est pas valide en raison de l'état actuel de l'objet.
à Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionContentTypeAndEventReceiverBindings(SPFeaturePropertyCollection props, SPSite site, SPWeb web, Boolean fForce)
à Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce)
à Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boo...
サイトのユーザーインターフェイスからこの機能を有効にしようとしましたか? –
はい、次のようなことが発生しました。ランタイムエラー 説明:サーバーでアプリケーションエラーが発生しました。このアプリケーションの現在のカスタムエラー設定により、アプリケーションエラーの詳細が表示されなくなります。 – Mosbah
これは何とか新しいバケーションのための通知のようです。 SharePointのベストプラクティスに準拠したソリューションを提供できるように、ビジネスシナリオを教えてください。 –