I have a C# workflow that I'm trying to create an IOrganzationService in that has the proxy types enabled on it so I can use my early bound data types...
This is how I'm creating the IOrganizationSerivce
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
But since I don't have an OrganizationServiceProxy object, I can't call EnableProxyTypes() on the service, and any create calls on the service using an early bound entity fails.
I know I can revert to setting the server url url, sdk server url, and organization in the app.config and use that to create an OrganizationServiceProxy but it seems like I should be able to just set the EnableProxyTypes on the IOrganizationService that I already have...
I believe this was a bug in 2011 and maybe 2013 that has long since been resolved. See Jim's answer with a link as to why you should not be using the accepted answer for 2015 or newer instances.
This is an old post, addressing an issue that was fixed long ago. But some of the workarounds provided here are not supported and will cause workflow activities that have used them to break.
Please see this: Remove unsupported code that uses reflection in custom workflow activities
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With