Creación de OrganizationServiceProxy en el complemento CRM2011
Frecuentes
Visto 1,843 equipos
0
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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Searched for the same issue but not working, Please suggest.
2 Respuestas
1
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, .. ) ?
Respondido 15 ago 13, 13:08
Inside Plugin ClientCredentials creds = new ClientCredentials(); creds.UserName.UserName = "<username>"; creds.UserName.Password = "<password>"; OrganizationServiceProxy service = new OrganizationServiceProxy(newUri("https://...Organization.svc"), null, creds,null); Is is possible to create OrganizationServiceProxy object in Online CRM. or is there any other way, please suggest. - anil p
0
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.
Respondido 30 ago 13, 12:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas dynamics-crm-2011 dynamics-crm dynamics-crm-online or haz tu propia pregunta.
Taking a long shot here: sandbox plugins have restricted access to localhost (loopback). Are you running you CRM org on same server as the one you are trying to connect? - MarioZG
I am using my plugin on Online CRM and try to connect another Online CRM. Any idea? - Anil P