RE: How to get user email from plugin ?
public class Example : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext pluginExecutionContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(pluginExecutionContext.UserId);
Entity task = pluginExecutionContext.InputParameters["Target"] as Entity;
Guid userId = pluginExecutionContext.UserId;
Entity user = service.Retrieve("systemuser", userId, new ColumnSet(new String[] { "internalemailaddress" }));
be sure do to null checking