質問
ドキュメントをチェックインするとき、 ItemCheckingInEvent
内でWebサービスを実行します。開発では、問題ありません。アプリを展開しましたが、構成ファイルを読み取るための十分な権限がないことがわかりました。私のコードは構成ファイルを読み取り、WCFプロキシを作成します。本当の問題は、 SPSecurity.RunWithElevatedPrivileges
関数を使用した場合、どのように関数から戻り値を取得できるかです。
例:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// exec service call
});
// need data from service call here
解決
昇格したデリゲートの前に作業オブジェクトを宣言し、内部で割り当てます。
object myServiceData = null;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
myServiceData = DoServiceStuff();
});
//do things with myServiceData
所属していません StackOverflow