HI all,
Can any one explain me about this Syntax.
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
Best Regards,
Praveen Kumar.C
*This post is locked for comments
HI all,
Can any one explain me about this Syntax.
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
Best Regards,
Praveen Kumar.C
*This post is locked for comments
Hi Praveen Kumar,
IPluginExecutionContext is where all the contextual information is brought to your code. InputParameters and OutputParameters member contain, for example, the record the plugin is being fired upon, the pre- and post-image, the handled message. These are all part of syntax for a plugin.
public void Execute(IServiceProvider serviceProvider) { IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory) serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); }
For getting the details of the IPluginExecutionContext, please refer the link below.
https://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.ipluginexecutioncontext.aspx
Hello,
In mentioned line code gets instance of IPluginExecutionContext frin serviceProvider. I'm not sure what confuses you?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156