Hi Amy,
Something like this should get you started. Hope this helps.
using System;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
namespace CRMPlugin
{
public class account: IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
if (context.MessageName.ToLower() == "delete" && context.PrimaryEntityName.ToLower() == "account")
{
throw new InvalidPluginExecutionException("Deletion of Account is not allowed");
}
}
}
}
Eric UNG [Senior Analyst Programmer :: Sydney, Australia]