This class is a base class to implement an XrmToolBox plugin control that requires multiple organizations connections. It comes with several built in Properties and Methods that will help you create an optimized plugin.
Note : this base class allows use of multiple OrganizationService. If you need only one OrganizationService, please use base class PluginControlBase
.
Note 2 : this class is a child of class PluginControlBase. So, all properties and methods of this base class also apply here
Working with Dynamics 365 CE OrganizationServices
This plugin uses the same OrganizationService that its parent class PluginControlBase
. To access it, simply use the property Service
.
Access additional organization services
To access additional Organization services, use property AdditionalConnectionDetails
foreach (var detail in AdditionalConnectionDetails)
{
detail.GetCrmServiceClient().Execute(new WhoAmIRequest());
}
Connect to additional organizations
To connect to an additional organization, you can simply call the method AddAdditionalOrganization
private void tsbAddTargetOrg_Click(object sender, EventArgs e)
{
AddAdditionalOrganization();
}
Currently, it is not possible to select multiple organizations in one single operation. You need to repeat the action to add multiple additional organizations.
Remove additional organizations
To remove an organization from the list of organizations, simply remove an item from the property AdditionalConnectionDetails
var toRemove = AdditionalConnectionDetails.FirstOrDefault(c => c.ConnectionName == "My Connection");
if (toRemove != null)
{
AdditionalConnectionDetails.Remove(toRemove);
}