30. Januar 2013 17:09
public Leads()
: base(typeof(Leads))
{
base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(20, "Create", "lead", new Action<LocalPluginContext>(ExecutePreLeadsCreateOrUpdate)));
base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(20, "Update", "lead", new Action<LocalPluginContext>(ExecutePreLeadsCreateOrUpdate)));
base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(20, "Import", "lead", new Action<LocalPluginContext>(ExecutePreLeadsCreateOrUpdate)));
}
2. Februar 2013 22:14
4. Februar 2013 09:38
public class Imports : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
if (serviceProvider == null)
{
throw new ArgumentNullException("serviceProvider");
}
// get the required interface from the service provider
IPluginExecutionContext localContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (localContext == null)
{
throw new ArgumentNullException("localContext");
}
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
ITracingService tracer = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
tracer.Trace("ENTER: AnyEntity.AnyEntityPlugin.Execute");
// retrieve the target entity
Entity targetEntity = null;
// Check if the input parameters property bag contains a target
// of the create operation and that target is of type Entity.
if (localContext.InputParameters.Contains("Target") && localContext.InputParameters["Target"] is Entity)
{
targetEntity = (Entity)localContext.InputParameters["Target"];
throw new InvalidPluginExecutionException("Entity: " + targetEntity.LogicalName);
}
else
{
return;
}
}
}
4. Februar 2013 12:23
targetEntity = (Entity)localContext.InputParameters["Target"];
throw new InvalidPluginExecutionException("Entity: " + targetEntity.LogicalName);
4. Februar 2013 12:37
4. Februar 2013 17:04
6. Februar 2013 13:07