I encountered the following code which solves my problem but I do not know how to call it in the Dynamics 365 system. I registered it using Plugin Deployer. However, I cannot see it in the steps section.
public
class
ReadAnnotation : IPlugin
{
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);
*This post is locked for comments