Microsoft.Crm.Sdk
およびによって提供されるAPIを介してCRM4のデータを問い合わせるASCXコントロール(このソリューションではWebパーツは使用されません)がありMicrosoft.Crm.SdkTypeProxy
ます。
このソリューションは、Sharepointに展開されるまで機能します。
最初に、次のエラーが発生しました。
[SecurityException: That assembly does not allow partially trusted callers.]
MyApp.SharePoint.Web.Applications.MyAppUtilities.RefreshUserFromCrm(String login) +0
MyApp.SharePoint.Web.Applications.MyApp_LoginForm.btnLogin_Click(Object sender, EventArgs e) +30
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
次に、呼び出し元のコードをASCXでSPSecurity.RunWithElevatedPrivilegesを使用してラップしてみました。
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// FBA user may not exist yet or require refreshing
MyAppUtilities.RefreshUserFromCrm(txtUser.Text);
});
しかし、これにより次のエラーが発生しました(RunWithElevatedPrivilegesはとにかくこの種のものではないと思いますが、誰かがそれを提案しました):
[SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.]
MyApp.SharePoint.Web.Applications.MyApp_LoginForm.btnLogin_Click(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
Sharepointサイトの信頼レベルを完全に上げると、すべてが正常に機能しますが、最小限の信頼(またはカスタマイズされた最小限の信頼)を使用するソリューションを考え出す必要があります。また、GACに何かを追加しないようにしています。何か案は?
から機能を呼び出そうとしたときに問題が発生していると思いますMicrosoft.Crm.*
。