[英]Unable to connect via connection string to Dynamics CRM Online. Organization cannot be null or empty. Parameter name: Organization Name
I'm trying to connect to CRM Online via connection string using Microsoft.CrmSdk.XrmTooling.CoreAssembly v 8.2.0.5
我正在尝试使用
Microsoft.CrmSdk.XrmTooling.CoreAssembly v 8.2.0.5
通过连接字符串连接到CRM Online
Following the guidelines at MSDN my connection string looks like this: AuthType=Office365;Username=jsmith@contoso.onmicrosoft.com; Password=passcode;Url=https://contoso.crm.dynamics.com
按照MSDN上的准则,我的连接字符串如下所示:
AuthType=Office365;Username=jsmith@contoso.onmicrosoft.com; Password=passcode;Url=https://contoso.crm.dynamics.com
AuthType=Office365;Username=jsmith@contoso.onmicrosoft.com; Password=passcode;Url=https://contoso.crm.dynamics.com
However, I get error an exception of type System.ArgumentNullException
with Message: Organization cannot be null or empty. 但是,我收到错误消息
System.ArgumentNullException
类型的异常,消息为: Organization不能为null或为空。 Parameter name: Organization Name 参数名称:组织名称
Source: Microsoft.Xrm.Tooling.Connector 来源: 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
{
}
}
The problem is here: 问题在这里:
"AuthType:Office365; ..."
This should be: 应该是:
"AuthType=Office365; ..."
you have to write the connectionstring like this: 您必须这样编写连接字符串:
<add name="Server=CRM Online,
organization=contoso, user=someone"
connectionString="Url=https://contoso.crm.dynamics.com;
Username=someone@contoso.onmicrosoft.com; Password=password; authtype=Office365"/> -->
Hope this help! 希望对您有所帮助!
您仍然需要将组织名称放在url的末尾,因此应该像这样:Url = https://contoso.crm.dynamics.com/contoso ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.