我尝试使用Microsoft.CrmSdk.XrmTooling.CoreAssembly v 8.2.0.5
遵循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
{
}
}
答案 0 :(得分:4)
问题在于:
"AuthType:Office365; ..."
这应该是:
"AuthType=Office365; ..."
答案 1 :(得分:0)
你必须像这样编写连接字符串:
<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"/> -->
希望这有帮助!
答案 2 :(得分:-1)
您仍然需要将组织名称放在url的末尾,因此应该像这样:Url = {https://contoso.crm.dynamics.com/contoso;