【问题标题】:How a .net Application can create a record in CRM contact table?.net 应用程序如何在 CRM 联系人表中创建记录?
【发布时间】:2010-08-16 23:50:58
【问题描述】:

我有一个现有的 .net Web 应用程序,可以在常规 SQL Server 数据库中创建客户联系人记录。现在我们正在迁移到 CRM。

我想知道 .NET Web 应用程序与 CRM 服务器通信并创建联系人记录的过程是什么?

谢谢

【问题讨论】:

    标签: dynamics-crm


    【解决方案1】:

    正如 bjynito 所说,你想看看 SDK,尤其是在开始时很有帮助的是 Programming Reference

    这里是从a page in the programming ref.创建联系人的示例

    // Set up the CRM Service.
    CrmAuthenticationToken token = new CrmAuthenticationToken();
    // You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
    token.AuthenticationType = 0; 
    token.OrganizationName = "AdventureWorksCycle";
    
    CrmService service = new CrmService();
    service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
    service.CrmAuthenticationTokenValue = token;
    service.Credentials = System.Net.CredentialCache.DefaultCredentials;
    
    // Create the contact object.
    contact contact = new contact();
    
    // Create the properties for the contact object.
    contact.firstname = "Jesper";
    contact.lastname = "Aaberg";
    contact.address1_line1 = "23 Market St.";
    contact.address1_city = "Sammamish";
    contact.address1_stateorprovince = "MT";
    contact.address1_postalcode = "99999";
    contact.donotbulkemail = new CrmBoolean();
    contact.donotbulkemail.Value = true;
    
    // Create the contact in Microsoft Dynamics CRM.
    Guid contactGuid = service.Create(contact);
    

    【讨论】:

      【解决方案2】:
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      
      using Microsoft.Xrm.Client;
      using Microsoft.Xrm.Sdk.Client;
      using Microsoft.Xrm.Sdk;
      using Microsoft.Xrm.Sdk.Query;
      using Microsoft.Xrm.Client.Services;
      
      namespace ConsoleApplication1
      {
          class Program
          {
              static void Main(string[] args)
              {
                  string connectionString = "Url=https://orgname.crm5.dynamics.com; Username=adminusername@damnidiot.onmicrosoft.com; Password=your  password;";   //configure this line 
      
                  string value = "lllllllll";
      
                  AttributeCollection at = new AttributeCollection();
                  //at.Add("fullname",(String)value);
                  at.Add("firstname", (String)"LLLL1");
                  at.Add("lastname", (String)"ffff1");
      
      
                  Entity ent = new Entity();
                  ent.LogicalName = "contact";
                  ent.Attributes=at;
                  CrmConnection connection = CrmConnection.Parse(connectionString);
                  OrganizationService organisationservice = new OrganizationService(connection);
                  Guid g = organisationservice.Create(ent);
      
      }}}
      

      【讨论】:

        【解决方案3】:

        我认为您误解了(或者我有) - CRM = 联系人关系管理,但并不意味着特定的服务器/架构

        例如,我编写使用 SQL Server 后端的 CRM 软件。如果您能提供更多信息,我们或许可以提供更多帮助

        【讨论】:

        • 听起来他在使用 Microsoft Dynamics CRM
        • 注意自检bl00dy标签
        【解决方案4】:

        推荐阅读SDK。特别是,请查看有关 Web 服务和可用消息的文章。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-11-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多