I want to send email using Microsoft Dynamics Crm 2011 plugin. but when i try to create Organizationserviceproxy it gives me error, the error is Shown below
Exception : Fehler bei der Anforderung des Berechtigungstyps "System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". bei Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary) bei Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration..ctor(Uri serviceUri, Boolean enableProxyTypes, Assembly assembly) bei Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration[TService](Uri serviceUri, Boolean enableProxyTypes, Assembly assembly) bei Microsoft.Xrm.Sdk.Client.ServiceProxy`1..ctor(Uri uri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredentials) bei only_Email.Plugins.EmailSend.Execute(IServiceProvider serviceProvider)
And down below is my code
Uri homeRealmUri = null;
ClientCredentials credentials;
Uri organizationUri;
credentials = newClientCredentials();
credentials.Windows.ClientCredential = newNetworkCredential("xx","xx","xx");
string orgUrl = http://xx/XRMServices/2011/Organization.svc;
organizationUri = newUri(orgUrl);
using (OrganizationServiceProxy _serviceProxy = newOrganizationServiceProxy(organizationUri,
homeRealmUri,
credentials, null))
{
}
Please if anyone can help. and yeah i m using on premise dynamics crm 2011