【发布时间】:2019-01-28 20:17:07
【问题描述】:
我正在尝试使用 Microsoft.CrmSdk.XrmTooling.CoreAssembly v 8.2.0.5 通过连接字符串连接到 CRM Online
按照MSDN 的指南,我的连接字符串如下所示:AuthType=Office365;Username=jsmith@contoso.onmicrosoft.com; Password=passcode;Url=https://contoso.crm.dynamics.com
但是,我收到 System.ArgumentNullException 类型的异常错误消息:组织不能为空或为空。
参数名称:组织名称
来源:Microsoft.Xrm.Tooling.Connector
public void GetClient()
{
try
{
var client = new CrmServiceClient(GetConnectionString());
Assert.IsTrue(client.IsReady);
}
catch (Exception ex)
{
throw;
}
}
private string GetConnectionString()
{
try
{
var connectionString = default(string);
try
{
connectionString = "AuthType:Office365;Url=https://MyCRM.crm4.dynamics.com; UserName=ATMain@MyOrganization.com;Password=MySecretPasscode;";
}
catch (Exception ex)
{
throw;
}
return connectionString;
}
finally
{
}
}
【问题讨论】:
-
您是否正在尝试连接到 CRM Online?也许您正在连接到某个本地实例并且只是使用了错误的身份验证类型?
-
是的,我确实正在尝试连接到在线 CRM。
-
粘贴 GetConnectionString 函数代码和 app.config 中的连接字符串(带有标签,但当然没有密码和登录名),我敢打赌你犯了一些简单的错误
-
告诉你这是一个简单的错误。我发布了答案
-
是的,完全错过了那个讨厌的结肠! :)
标签: c# dynamics-crm dynamics-365