Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
Indicates whether the Dynamics GP service is installed in a multitenant configuration.
Parameters
None
Return Value:
Value |
Type |
Description |
|---|---|---|
MultitenantEnabledResult |
boolean |
The value true indicates that a multitenant configuration is being used. The value false indicates that the Tenant Service is not being used. |
Interfaces
- Dynamics GP
- Common
Examples
The following C# example retrieves the status that indicates whether tenants are enabled for the Microsoft Dynamics GP installation. If tenants aren't enabled, a message is displayed. If tenants are enabled, the list of all tenants is retrieved and displayed in a message box.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
bool tenantEnabled;
Tenant[] tenants;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure the default credentials are used
wsDynamicsGP.UseDefaultCredentials = true;
// Find out whether tenants are enabled
tenantEnabled = wsDynamicsGP.MultitenantEnabled();
if (tenantEnabled == true)
{
// Tenants are enabled, so retrieve a list of all the tenants
tenants = wsDynamicsGP.GetTenantList(false);
// Display the list of tenants
StringBuilder tenantList = new StringBuilder();
foreach (Tenant t in tenants)
{
tenantList.AppendLine(t.Name);
}
MessageBox.Show(tenantList.ToString());
}
else
{
MessageBox.Show("Tenants are not enabled.");
}
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
bool tenantEnabled;
Tenant[] tenants;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Find out whether tenants are enabled
tenantEnabled = wsDynamicsGP.MultitenantEnabled();
if (tenantEnabled == true)
{
// Tenants are enabled, so retrieve a list of all the tenants
tenants = wsDynamicsGP.GetTenantList(false);
// Display the list of tenants
StringBuilder tenantList = new StringBuilder();
foreach (Tenant t in tenants)
{
tenantList.AppendLine(t.Name);
}
MessageBox.Show(tenantList.ToString());
}
else
{
MessageBox.Show("Tenants are not enabled.");
}
// Close the service
if (wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}