Touchstone Re 2023 API Reference
GetDataServers Method
Example 


Air.Services.Proxy Assembly > (Global) Namespace > DataSourceManagementServiceClient Class : GetDataServers Method
Contains a GetDataServersRequest that identifies the Business Unit SID and SQL Instance SID associated with the list of Data Servers that you want to retrieve.
Retrieves a list of all existing Touchstone® SQL Data Servers that are registered with the Touchstone application and available to the current Project.

Use the GetDataServers() method to find out the name and Touchstone-generated Data Server Sequential Identifier (SID) of each Data Server that is registered with the Touchstone application. This method also returns the file path to the server (MDF file path) and the path to the log file of actions that the server recently executed (LDF file path).

Syntax
Public Function GetDataServers( _
   ByVal request As GetDataServersRequest _
) As GetDataServersResponse
Dim instance As DataSourceManagementServiceClient
Dim request As GetDataServersRequest
Dim value As GetDataServersResponse
 
value = instance.GetDataServers(request)

Parameters

request
Contains a GetDataServersRequest that identifies the Business Unit SID and SQL Instance SID associated with the list of Data Servers that you want to retrieve.

Return Value

A GetDataServersResponse containing a list of Data Servers that are registered with the Touchstone application and available to the current Project.
Remarks
To find the Business Unit SID to pass into this method, call the GetBusinessUnits() method.

To find the SQL Instance SID to pass into this method, call the GetSqlInstances() method.

Example
The following example shows how to retrieve a list of all Touchstone Data Servers that are registered with the Touchstone application and available to the current Project using the GetDataServers() method:
using System;
using AIR.Services.Common.Data;
using AIR.Services.DataSourceManagement.Api;
using AIR.Services.DataSourceManagement.Data;
            
class SnippetGetDataServersRequest
{
    private static void GetDataServers(int businessUnitSid, int sqlInstanceSid)
    {
        DataSourceManagementServiceClient dsClient = new DataSourceManagementServiceClient();
        GetDataServersRequest request = new GetDataServersRequest();
        request.BusinessUnitSid = businessUnitSid;
        request.SqlInstanceSid = sqlInstanceSid;
        GetDataServersResponse response = dsClient.GetDataServers(request);
        if (response.Status.Code == StatusCode.Success)
        {
            foreach (DataServer ds in response.DataServers)
            {
                Console.WriteLine("------------------------------------------------------------");
                Console.WriteLine("SID: " + ds.Sid);
                Console.WriteLine("Name: " + ds.Name);
                Console.WriteLine("Default MDF File Path: " + ds.DefaultMdfFilePath);
                Console.WriteLine("Default LDF File Path: " + ds.DefaultLdfFilePath);
            }
        }
            
    }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DataSourceManagementServiceClient Class
DataSourceManagementServiceClient Members