Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
U kunt routering activeren voor niet-case records, zoals e-mailberichten, programmeerbaar met behulp van de IPlugin-interface.
U kunt de volgende voorbeeldcode gebruiken in uw console-app (.NET-framework) van Visual Studio. De code controleert op de volgende twee voorwaarden en als aan deze voorwaarden wordt voldaan, wordt de msdyn_ApplyRoutingRuleEntityRecord actie geactiveerd.
- of het webservicebericht bedoeld is om een record te maken
- of het record een e-mailbericht is.
public class SamplePlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
// Obtain the tracing service
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
// Obtain the execution context from the service provider
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
// Check if create message
if (context.MessageName.ToLower().Equals("create"))
{
// The InputParameters collection contains all the data passed in the message request
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parameters
Entity entity = (Entity)context.InputParameters["Target"];
// Target is an email
if (entity.LogicalName.ToLower().Equals("email"))
{
try
{
// Obtain the organization service reference that you'll need for web service calls
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
// Execute msdyn_ApplyRoutingRuleEntityRecord request
OrganizationRequest request = new OrganizationRequest("msdyn_ApplyRoutingRuleEntityRecord");
request["Target"] = new EntityReference("email", entity.Id);
service.Execute(request);
}
catch (Exception ex)
{
tracingService.Trace("SamplePlugin: {0}", ex.ToString());
throw;
}
}
}
}
}
}
}
Verwante informatie
Overzicht van doorsturen
Doorsturen instellen voor records
Records handmatig doorsturen
Records automatisch doorsturen met behulp van stroom