There are a lot of syntax and functional changes in MSCRM 2011 plugins. I have listed some of them below:
1. New References
2. Microsoft.Crm.Sdk has been replaced by Microsoft.Xrm.Sdk
3. The default parameter for execute method has been changed from
IPluginExecutionContext to IServiceProvide
public void Execute(IServiceProvider serviceProvider)
4. IpluginExecutionContext has been changed to a type of service and to get the reference use the following syntax.
IPluginExecutionContext context = (IPluginExecutionContext)
5. ICrmService has been changed to IOrganizationService
IOrganizationServiceFactory serviceFactory =
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
6. Dynamic entity has been changed to “Entity”
if (context.InputParameters.Contains(“Target”) &&
context.InputParameters[“Target”] is Entity)
Entity entity = (Entity)context.InputParameters[“Target”];
7. Dynamic Entity’s properties syntax has been changed to attributes
8. Strongly typed classes (account, contact) are missing in Microsoft.XRM.Sdk assembly but there is an exception to this.
9. CRM 2011 provides the crm utility called “crmsvcutil” to generate strongly typed classes that can be used in plugins.
10. Strongly typed classes has been changed to use like loosely typed classes.
Task task = new Task();
Task[“description”] = ”test description”
11. No more soap exception
catch (FaultException ex)