プラグインで OrganizationServiceProxy インスタンスを作成する方法はありますか?
EnableProxyTypesメソッドの引数にプラグインアセンブリとは別のアセンブリを渡してEnableProxyTypesメソッドを実行したい。
事前にバインドされたクラスを持ち、いくつかのプラグインやプログラムで共有されるアセンブリ ファイルが必要なためです。
public void Execute(IServiceProvider serviceProvider)
{
var context = (IPluginExecutionContext) serviceProvider.GetService(typeof (IPluginExecutionContext));
var factory = (IOrganizationServiceFactory) serviceProvider.GetService(typeof (IOrganizationServiceFactory));
var service = factory.CreateOrganizationService(context.UserId);
var proxy = (OrganizationServiceProxy)service; //this doesn't work. an error occurs.
}