Hi,
My plugin throws this exception on 'OrganizationServiceProxy'.
OrganizationServiceProxy orgService = new OrganizationServiceProxy(organizationUri, homeRealmUri, clientCredentials, null);
An exception of type 'System.Security.SecurityException' occurred in Microsoft.Xrm.Sdk.dll but was not handled in user code
Additional information: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Here is one if my plugin methods where this exception occurs: Here I am trying to get sharepoint location
public static string GetSharePointLocation(string entAccountID)
{
try
{
ClientCredentials clientCredentials = new ClientCredentials();
clientCredentials.UserName.UserName = @"abc\xxxx";
clientCredentials.UserName.Password = "xxxxxxx";
Uri organizationUri = new Uri("xxxxxxxx/.../Organization.svc");
Uri homeRealmUri = null;
OrganizationServiceProxy orgService = new OrganizationServiceProxy(organizationUri, homeRealmUri, clientCredentials, null);
orgService.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
Guid guidSPDocLoc = RetrieveSharePointLocation(orgService, entAccountID);
string absouteUrl = GetAbslouteUrl(orgService, guidSPDocLoc);
orgService.Dispose();
return absouteUrl;
}
catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> ex)
{
return ex.Message;
}
}
Somebody please guide me in resolving this issue.
Thanks for any help.