.net应用程序如何在CRM联系表中创建记录?

时间:2010-08-16 23:50:59

标签: dynamics-crm

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

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

由于

4 个答案:

答案 0 :(得分:4)

正如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);

答案 1 :(得分: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);

}}}

答案 2 :(得分:0)

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

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

答案 3 :(得分:0)

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