I have created a plugin and it was registered successfully (Sandbox Isolation Mode).
Inside Plugin execution, I want to create an object of OrganizationServiceProxy, which is using another CRM details. Using the code below:
Uri oUri = new Uri("https://yourorg.api.crm5.dynamics.com/XRMServices/2011/Organization.svc"); //** Your client credentials ClientCredentials clientCredentials = new ClientCredentials(); clientCredentials.UserName.UserName = "YourAccount.onmicrosoft.com"; clientCredentials.UserName.Password = "YourAdminPassword"; //Create your Organization Service Proxy OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy( oUri, null, clientCredentials, null);
I am getting Security Exception:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Searched for the same issue but not working, Please suggest.
preguntado el 15 de agosto de 13 a las 13:08
What version of .NET are you building this in ?
check out these links:
This error is usually caused by some process that doesn't have enough permissions to run. I had this issue before and it solved my problem.
I basically used the new
AddFullTrustModuleInSandboxAppDomain method. (check links for more info)
Where exactly do you get this error? When trying to create the proxy ? Or when the plugin is trying to do something (create a report, .. ) ?
I have searched a lot but the plugin is registered in sandbox mode so it, doesn't allow to access external services.
Found the best way to use it.
Created Azure web service and use the service in Plugin, it works.