简体   繁体   English

无法通过连接字符串连接到Dynamics CRM Online。 组织不能为null或为空。 参数名称:组织名称

[英]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"/> -->

sample to-do 样品待办

Hope this help! 希望对您有所帮助!

您仍然需要将组织名称放在url的末尾,因此应该像这样:Url = https://contoso.crm.dynamics.com/contoso ;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 值不能为 null 或为空。 参数名称linkText - Value cannot be null or empty. Parameter name linkText 收到错误值不能为null或为空。 参数名称:URL - Getting an error Value cannot be null or empty. Parameter name: URL 如何修复 MVC 应用程序中的“System.ArgumentException:'值不能为 null 或为空。参数名称:名称'”? - How to fix a "System.ArgumentException: 'Value cannot be null or empty. Parameter name: name'" in a MVC app? MVC5 Razor 值不能为 null 或为空。 参数名称:名称 - MVC5 Razor Value cannot be null or empty. Parameter name: name 值不能为null或为空。\ r \ nParameter name:name - Value cannot be null or empty.\r\nParameter name: name Developers Toolkit中用于开发Dynamics CRM插件的Organization Service为null - Organization Service is null in Developers Toolkit for developing Dynamics CRM Plugin 如何使用 Web Api 在 Dynamics 365 CRM(在线)中发现我的组织的 URL - How to discover the URL for my organization in Dynamics 365 CRM (online) using Web Api 即使在 CRM 动态中使用了正确的凭据,也无法连接到组织服务 - C# - Not able to connect to Organization service even with used correct credentials in CRM dynamics - C# ASP.NET Identity CreateAsync返回错误“名称不能为null或为空。” - ASP.NET Identity CreateAsync returning Error “Name cannot be null or empty.” Dynamics Crm 2015:值不能为空。\\ r \\ n参数名称:详细信息 - Dynamics Crm 2015: Value cannot be null.\r\nParameter name: detail
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM