am trying to connect Exchange Server through EWS API 2.0 from the plugin, the same code runs under windows form application, but through the plugin its throwing error at initializing the Exchange Service.

Below is my Plugin - Trace..

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unexpected exception from plug-in (Execute): XXX.XRM.ExchangeSynch.Plugin.ExchangeSynch: System.TypeInitializationException: The type initializer for 'Microsoft.Exchange.WebServices.Data.ExchangeServiceBase' threw an exception.Detail: 
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
<ActivityId>67a1bbca-404b-4538-94c9-acdcec385d33</ActivityId>
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />
<Message>Unexpected exception from plug-in (Execute): xxx.XRM.ExchangeSynch.Plugin.ExchangeSynch: System.TypeInitializationException: The type initializer for 'Microsoft.Exchange.WebServices.Data.ExchangeServiceBase' threw an exception.</Message>
<Timestamp>2019-05-08T11:24:21.9139154Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource>PluginExecution</ExceptionSource>
<InnerFault>
<ActivityId>67a1bbca-404b-4538-94c9-acdcec385d33</ActivityId>
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d3p1="schemas.datacontract.org/.../System.Collections.Generic" />
<Message>Request failed.xxx.XRM.ExchangeSynch.Plugin.ExchangeSynch: System.Security.SecurityException: Request failed.</Message>
<Timestamp>2019-05-08T11:24:21.9139154Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<OriginalException>System.TypeInitializationException
at Microsoft.Exchange.WebServices.Data.ExchangeServiceBase..ctor(ExchangeVersion requestedServerVersion)
at Microsoft.Exchange.WebServices.Data.ExchangeService..ctor(ExchangeVersion requestedServerVersion)
at xxx.XRM.ExchangeSynch.Plugin.ExchangeSynch.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.&lt;&gt;c__DisplayClass8.&lt;Execute&gt;b__1()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext, Boolean enablePluginStackTrace, Boolean chaosFailAppDomain)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext, Boolean enablePluginStackTrace, Boolean chaosFailAppDomain)
at Microsoft.Crm.Sandbox.SandboxWorker.Execute(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, SandboxRequestCounter&amp; workerCounter, Boolean returnTraceInfo)</OriginalException>
<TraceText>
FollowupPlugin: System.TypeInitializationException: The type initializer for 'Microsoft.Exchange.WebServices.Data.ExchangeServiceBase' threw an exception. ---&gt; System.Security.SecurityException: Request failed.
at Microsoft.Exchange.WebServices.Data.EwsUtilities.&lt;.cctor&gt;b__9()
at Microsoft.Exchange.WebServices.Data.LazyMember`1.get_Member()
at Microsoft.Exchange.WebServices.Data.EwsUtilities.get_BuildVersion()
at Microsoft.Exchange.WebServices.Data.ExchangeServiceBase..cctor()
--- End of inner exception stack trace ---
at Microsoft.Exchange.WebServices.Data.ExchangeServiceBase..ctor(ExchangeVersion requestedServerVersion)
at Microsoft.Exchange.WebServices.Data.ExchangeService..ctor(ExchangeVersion requestedServerVersion)
at xxx.XRM.ExchangeSynch.Plugin.ExchangeSynch.Execute(IServiceProvider serviceProvider)
</TraceText>
</OrganizationServiceFault>

Server stack trace: 
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Crm.Sandbox.ISandboxHost.ExecuteAndReturnTraceInfo(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxPlugin.Execute(SandboxClient client, SandboxCallTracker callTracker, IExecutionContext requestContext, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)