Share via


CrmServiceClient Constructors

Definition

Overloads

CrmServiceClient(OrganizationServiceProxy)

Uses the Organization service proxy provided by the user.

CrmServiceClient(String, SecureString, String, String, String, String, String, Boolean, Boolean, OrganizationDetail, UserIdentifier, String, Uri, String, OrganizationWebProxyClient, PromptBehavior)

Log in with OAuth for On-Premises connections.

CrmServiceClient(String, SecureString, String, String, Boolean, OrganizationDetail, UserIdentifier, String, Uri, String, OrganizationWebProxyClient, PromptBehavior, Boolean)

Log in with OAuth for online connections.

CrmServiceClient(X509Certificate2, StoreName, String, Uri, String, Boolean, Boolean, OrganizationDetail, String, Uri, String)

Log in with Certificate Auth On-Premises connections.

CrmServiceClient(String, SecureString, String, String, String, String, String, Boolean, Boolean, OrganizationDetail)

Logs in with Claims based User ID

CrmServiceClient(X509Certificate2, StoreName, String, Uri, Boolean, OrganizationDetail, String, Uri, String)

Log in with Certificate Auth OnLine connections. This requires the org API URI.

CrmServiceClient(NetworkCredential, AuthenticationType, String, String, String, Boolean, Boolean, OrganizationDetail)

Logs in with User Supplied Settings using AD or IFD

CrmServiceClient(String, SecureString, String, String, Boolean, Boolean, OrganizationDetail, Boolean)

Logs in with User Supplied Settings using Windows Live or Office 365

CrmServiceClient(Uri, String, String, Boolean, String)

ClientID \ ClientSecret Based Authentication flow.

CrmServiceClient(Uri, String, SecureString, Boolean, String)

ClientID \ ClientSecret Based Authentication flow, allowing for Secure Client ID passing.

CrmServiceClient(Uri, Boolean)

Offloads Authentication to class that implements IOverrideAuthHookWrapper.

CrmServiceClient(String)

CrmServiceClient to accept the connectionstring as a parameter.

CrmServiceClient(OrganizationWebProxyClient)

Uses the Organization Web proxy Client provided by the user

CrmServiceClient(NetworkCredential, String, String, String, Boolean, Boolean, OrganizationDetail)

Logs in with User Supplied Settings using AD

CrmServiceClient(OrganizationServiceProxy)

Uses the Organization service proxy provided by the user.

public:
 CrmServiceClient(Microsoft::Xrm::Sdk::Client::OrganizationServiceProxy ^ externalOrgServiceProxy);
public CrmServiceClient (Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy externalOrgServiceProxy);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (externalOrgServiceProxy As OrganizationServiceProxy)

Parameters

externalOrgServiceProxy
OrganizationServiceProxy

User Provided Organization service proxy

Applies to

CrmServiceClient(String, SecureString, String, String, String, String, String, Boolean, Boolean, OrganizationDetail, UserIdentifier, String, Uri, String, OrganizationWebProxyClient, PromptBehavior)

Log in with OAuth for On-Premises connections.

public CrmServiceClient (string crmUserId, System.Security.SecureString crmPassword, string domain, string homeRealm, string hostName, string port, string orgName, bool useSsl, bool useUniqueInstance, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail, Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier user, string clientId, Uri redirectUri, string tokenCachePath, Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient externalOrgWebProxyClient, Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior promptBehavior = Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior.Auto);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : string * System.Security.SecureString * string * string * string * string * string * bool * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail * Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier * string * Uri * string * Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient * Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (crmUserId As String, crmPassword As SecureString, domain As String, homeRealm As String, hostName As String, port As String, orgName As String, useSsl As Boolean, useUniqueInstance As Boolean, orgDetail As OrganizationDetail, user As UserIdentifier, clientId As String, redirectUri As Uri, tokenCachePath As String, externalOrgWebProxyClient As OrganizationWebProxyClient, Optional promptBehavior As PromptBehavior = Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior.Auto)

Parameters

crmUserId
String

User Id supplied

crmPassword
SecureString

Password for login

domain
String

Domain

homeRealm
String

Name of the organization to connect

hostName
String

Host name of the server that is hosting the CRM web service

port
String

Port number on the CRM Host Server ( usually 444 )

orgName
String

Organization name for the CRM Instance.

useSsl
Boolean

if true, https:// used

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

user
Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier

The user identifier.

clientId
String

The registered client Id on Azure portal.

redirectUri
Uri

The redirect URI application will be redirected post OAuth authentication.

tokenCachePath
String

The token cache path where token cache file is placed.

externalOrgWebProxyClient
OrganizationWebProxyClient

The proxy for OAuth.

promptBehavior
Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior

The prompt Behavior.

Applies to

CrmServiceClient(String, SecureString, String, String, Boolean, OrganizationDetail, UserIdentifier, String, Uri, String, OrganizationWebProxyClient, PromptBehavior, Boolean)

Log in with OAuth for online connections.

public CrmServiceClient (string crmUserId, System.Security.SecureString crmPassword, string crmRegion, string orgName, bool useUniqueInstance, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail, Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier user, string clientId, Uri redirectUri, string tokenCachePath, Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient externalOrgWebProxyClient, Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior promptBehavior = Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior.Auto, bool useDefaultCreds = false);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : string * System.Security.SecureString * string * string * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail * Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier * string * Uri * string * Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient * Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior * bool -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (crmUserId As String, crmPassword As SecureString, crmRegion As String, orgName As String, useUniqueInstance As Boolean, orgDetail As OrganizationDetail, user As UserIdentifier, clientId As String, redirectUri As Uri, tokenCachePath As String, externalOrgWebProxyClient As OrganizationWebProxyClient, Optional promptBehavior As PromptBehavior = Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior.Auto, Optional useDefaultCreds As Boolean = false)

Parameters

crmUserId
String

User Id supplied

crmPassword
SecureString

Password for login

crmRegion
String

Region where server is provisioned in for login

orgName
String

Name of the organization to connect

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

user
Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier

The user identifier.

clientId
String

The registered client Id on Azure portal.

redirectUri
Uri

The redirect URI application will be redirected post OAuth authentication.

tokenCachePath
String

The token cache path where token cache file is placed.

externalOrgWebProxyClient
OrganizationWebProxyClient

The proxy for OAuth.

promptBehavior
Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior

The prompt Behavior.

useDefaultCreds
Boolean

(optional) If true attempts login using current user ( Online )

Applies to

CrmServiceClient(X509Certificate2, StoreName, String, Uri, String, Boolean, Boolean, OrganizationDetail, String, Uri, String)

Log in with Certificate Auth On-Premises connections.

public:
 CrmServiceClient(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate, System::Security::Cryptography::X509Certificates::StoreName certificateStoreName, System::String ^ certificateThumbPrint, Uri ^ instanceUrl, System::String ^ orgName, bool useSsl, bool useUniqueInstance, Microsoft::Xrm::Sdk::Discovery::OrganizationDetail ^ orgDetail, System::String ^ clientId, Uri ^ redirectUri, System::String ^ tokenCachePath);
public CrmServiceClient (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Security.Cryptography.X509Certificates.StoreName certificateStoreName, string certificateThumbPrint, Uri instanceUrl, string orgName, bool useSsl, bool useUniqueInstance, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail, string clientId, Uri redirectUri, string tokenCachePath);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.X509Certificates.StoreName * string * Uri * string * bool * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail * string * Uri * string -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (certificate As X509Certificate2, certificateStoreName As StoreName, certificateThumbPrint As String, instanceUrl As Uri, orgName As String, useSsl As Boolean, useUniqueInstance As Boolean, orgDetail As OrganizationDetail, clientId As String, redirectUri As Uri, tokenCachePath As String)

Parameters

certificate
X509Certificate2

Certificate to use during login

certificateStoreName
StoreName

StoreName to look in for certificate identified by certificateThumbPrint

certificateThumbPrint
String

ThumbPrint of the Certificate to load

instanceUrl
Uri

URL of the CRM instance to connect too

orgName
String

Organization name for the CRM Instance.

useSsl
Boolean

if true, https:// used

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

clientId
String

The registered client Id on Azure portal.

redirectUri
Uri

The redirect URI application will be redirected post OAuth authentication.

tokenCachePath
String

The token cache path where token cache file is placed.

Applies to

CrmServiceClient(String, SecureString, String, String, String, String, String, Boolean, Boolean, OrganizationDetail)

Logs in with Claims based User ID

public CrmServiceClient (string userId, System.Security.SecureString password, string domain, string homeRealm, string hostName, string port, string orgName, bool useUniqueInstance = false, bool useSsl = false, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail = default);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : string * System.Security.SecureString * string * string * string * string * string * bool * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (userId As String, password As SecureString, domain As String, homeRealm As String, hostName As String, port As String, orgName As String, Optional useUniqueInstance As Boolean = false, Optional useSsl As Boolean = false, Optional orgDetail As OrganizationDetail = Nothing)

Parameters

userId
String

User Id to login with

password
SecureString

Password to use in Login

domain
String

Domain name to use when logging in

homeRealm
String

Home realm of the user

hostName
String

Host name of the server that is hosting the CRM web or discovery service

port
String

Port number on the CRM Host or Discovery Server ( usually 5555 )

orgName
String

Organization name for the CRM Instance.

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

useSsl
Boolean

if true, https:// used

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

Applies to

CrmServiceClient(X509Certificate2, StoreName, String, Uri, Boolean, OrganizationDetail, String, Uri, String)

Log in with Certificate Auth OnLine connections. This requires the org API URI.

public:
 CrmServiceClient(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate, System::Security::Cryptography::X509Certificates::StoreName certificateStoreName, System::String ^ certificateThumbPrint, Uri ^ instanceUrl, bool useUniqueInstance, Microsoft::Xrm::Sdk::Discovery::OrganizationDetail ^ orgDetail, System::String ^ clientId, Uri ^ redirectUri, System::String ^ tokenCachePath);
public CrmServiceClient (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Security.Cryptography.X509Certificates.StoreName certificateStoreName, string certificateThumbPrint, Uri instanceUrl, bool useUniqueInstance, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail, string clientId, Uri redirectUri, string tokenCachePath);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.X509Certificates.StoreName * string * Uri * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail * string * Uri * string -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (certificate As X509Certificate2, certificateStoreName As StoreName, certificateThumbPrint As String, instanceUrl As Uri, useUniqueInstance As Boolean, orgDetail As OrganizationDetail, clientId As String, redirectUri As Uri, tokenCachePath As String)

Parameters

certificate
X509Certificate2

Certificate to use during login

certificateStoreName
StoreName

StoreName to look in for certificate identified by certificateThumbPrint

certificateThumbPrint
String

ThumbPrint of the Certificate to load

instanceUrl
Uri

API URL of the CRM instance to connect too

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

clientId
String

The registered client Id on Azure portal.

redirectUri
Uri

The redirect URI application will be redirected post OAuth authentication.

tokenCachePath
String

The token cache path where token cache file is placed.

Applies to

CrmServiceClient(NetworkCredential, AuthenticationType, String, String, String, Boolean, Boolean, OrganizationDetail)

Logs in with User Supplied Settings using AD or IFD

public CrmServiceClient (System.Net.NetworkCredential credential, Microsoft.Xrm.Tooling.Connector.AuthenticationType authType, string hostName, string port, string orgName, bool useUniqueInstance = false, bool useSsl = false, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail = default);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : System.Net.NetworkCredential * Microsoft.Xrm.Tooling.Connector.AuthenticationType * string * string * string * bool * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (credential As NetworkCredential, authType As AuthenticationType, hostName As String, port As String, orgName As String, Optional useUniqueInstance As Boolean = false, Optional useSsl As Boolean = false, Optional orgDetail As OrganizationDetail = Nothing)

Parameters

credential
NetworkCredential

Initialized Network Credential object

authType
AuthenticationType

Authorization Type requested, Either AD or SPLA is supported with this constructor

hostName
String

Host name of the server that is hosting the CRM web or discovery service

port
String

Port number on the CRM Host or Discovery Server ( usually 5555 )

orgName
String

Organization name for the CRM Instance.

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

useSsl
Boolean

if true, https:// used

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

Applies to

CrmServiceClient(String, SecureString, String, String, Boolean, Boolean, OrganizationDetail, Boolean)

Logs in with User Supplied Settings using Windows Live or Office 365

public CrmServiceClient (string crmUserId, System.Security.SecureString crmPassword, string crmRegion, string orgName, bool useUniqueInstance = false, bool useSsl = false, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail = default, bool isOffice365 = false);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : string * System.Security.SecureString * string * string * bool * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail * bool -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (crmUserId As String, crmPassword As SecureString, crmRegion As String, orgName As String, Optional useUniqueInstance As Boolean = false, Optional useSsl As Boolean = false, Optional orgDetail As OrganizationDetail = Nothing, Optional isOffice365 As Boolean = false)

Parameters

crmUserId
String

UserName for Live or Office 365

crmPassword
SecureString

Password for Live or Office 365

crmRegion
String

Region that the CRM live or office 365 servers is provisioned in, if empty, a search will be run.

orgName
String

Organization name for the CRM Instance.

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

useSsl
Boolean

if true, https:// used

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

isOffice365
Boolean

if true, uses OSDP / office 365 methods

Applies to

CrmServiceClient(Uri, String, String, Boolean, String)

ClientID \ ClientSecret Based Authentication flow.

public:
 CrmServiceClient(Uri ^ instanceUrl, System::String ^ clientId, System::String ^ clientSecret, bool useUniqueInstance, System::String ^ tokenCachePath);
public CrmServiceClient (Uri instanceUrl, string clientId, string clientSecret, bool useUniqueInstance, string tokenCachePath);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : Uri * string * string * bool * string -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (instanceUrl As Uri, clientId As String, clientSecret As String, useUniqueInstance As Boolean, tokenCachePath As String)

Parameters

instanceUrl
Uri

Direct URL of CRM instance to connect too.

clientId
String

The registered client Id on Azure portal.

clientSecret
String

Client Secret for Client Id.

useUniqueInstance
Boolean

Use unique instance or reuse current connection.

tokenCachePath
String

The token cache path where token cache file is placed.

Applies to

CrmServiceClient(Uri, String, SecureString, Boolean, String)

ClientID \ ClientSecret Based Authentication flow, allowing for Secure Client ID passing.

public:
 CrmServiceClient(Uri ^ instanceUrl, System::String ^ clientId, System::Security::SecureString ^ clientSecret, bool useUniqueInstance, System::String ^ tokenCachePath);
public CrmServiceClient (Uri instanceUrl, string clientId, System.Security.SecureString clientSecret, bool useUniqueInstance, string tokenCachePath);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : Uri * string * System.Security.SecureString * bool * string -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (instanceUrl As Uri, clientId As String, clientSecret As SecureString, useUniqueInstance As Boolean, tokenCachePath As String)

Parameters

instanceUrl
Uri

Direct URL of CRM instance to connect too.

clientId
String

The registered client Id on Azure portal.

clientSecret
SecureString

Client Secret for Client Id.

useUniqueInstance
Boolean

Use unique instance or reuse current connection.

tokenCachePath
String

The token cache path where token cache file is placed.

Applies to

CrmServiceClient(Uri, Boolean)

Offloads Authentication to class that implements IOverrideAuthHookWrapper.

public:
 CrmServiceClient(Uri ^ instanceUrl, bool useUniqueInstance);
public CrmServiceClient (Uri instanceUrl, bool useUniqueInstance);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : Uri * bool -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (instanceUrl As Uri, useUniqueInstance As Boolean)

Parameters

instanceUrl
Uri

Direct URL of CRM instance to connect too.

useUniqueInstance
Boolean

Use unique instance or reuse current connection.

Applies to

CrmServiceClient(String)

CrmServiceClient to accept the connectionstring as a parameter.

public:
 CrmServiceClient(System::String ^ crmConnectionString);
public CrmServiceClient (string crmConnectionString);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : string -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (crmConnectionString As String)

Parameters

crmConnectionString
String

Applies to

CrmServiceClient(OrganizationWebProxyClient)

Uses the Organization Web proxy Client provided by the user

public:
 CrmServiceClient(Microsoft::Xrm::Sdk::WebServiceClient::OrganizationWebProxyClient ^ externalOrgWebProxyClient);
public CrmServiceClient (Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient externalOrgWebProxyClient);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClient -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (externalOrgWebProxyClient As OrganizationWebProxyClient)

Parameters

externalOrgWebProxyClient
OrganizationWebProxyClient

User Provided Organization Web Proxy Client

Applies to

CrmServiceClient(NetworkCredential, String, String, String, Boolean, Boolean, OrganizationDetail)

Logs in with User Supplied Settings using AD

public CrmServiceClient (System.Net.NetworkCredential credential, string hostName, string port, string orgName, bool useUniqueInstance = false, bool useSsl = false, Microsoft.Xrm.Sdk.Discovery.OrganizationDetail orgDetail = default);
new Microsoft.Xrm.Tooling.Connector.CrmServiceClient : System.Net.NetworkCredential * string * string * string * bool * bool * Microsoft.Xrm.Sdk.Discovery.OrganizationDetail -> Microsoft.Xrm.Tooling.Connector.CrmServiceClient
Public Sub New (credential As NetworkCredential, hostName As String, port As String, orgName As String, Optional useUniqueInstance As Boolean = false, Optional useSsl As Boolean = false, Optional orgDetail As OrganizationDetail = Nothing)

Parameters

credential
NetworkCredential

Initialized Network Credential object

hostName
String

Host name of the server that is hosting the CRM web service

port
String

Port number on the CRM Host Server ( usually 5555 )

orgName
String

Organization name for the CRM Instance.

useUniqueInstance
Boolean

if set, will force the system to create a unique connection

useSsl
Boolean

if true, https:// used

orgDetail
OrganizationDetail

CRM Org Detail object, this is is returned from a query to the CRM Discovery Server service. not required.

Applies to