Wednesday, October 26, 2011

CRM 2011 - Use IOrganizationService in Plugin MSCRM 2011.

Following code allow connects to the Microsoft Dynamics CRM 2011 platform using the IOrganizationService Web Service.

// Comment
//use your prefered userId to get IOrganicazionService by context
private IOrganizationService getService(IServiceProvider serviceProvider, Guid userId)
        {
            IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            return serviceFactory.CreateOrganizationService(userId);
        }


Thanks,
Nicola Grillo

No comments:

Post a Comment