2010-07-13 1 views
1

내 코드 샘플입니다 연락처를 만들고 업데이트 ... 사용자 정의 필드 MSCRM 여기에 4

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 
using ProjectName.CrmSdk; 

//The CrmSdk ref is to the webservice url. 

      //ServerName and OrgName are setup in code but not included. 
      //standard CRM service setup 
      CrmSdk.CrmAuthenticationToken token = new CrmSdk.CrmAuthenticationToken(); 
      token.AuthenticationType = 0; //AD on premise 
      token.OrganizationName = orgName.ToString(); 
      CrmService service = new CrmService(); 
      service.Url = "http://" + serverName.ToString() + "/mscrmservices/2007/crmservice.asmx"; 
      service.CrmAuthenticationTokenValue = token; 
      service.Credentials = System.Net.CredentialCache.DefaultCredentials; 


      contact c = new contact(); 

      c.firstname = "joe"; 
      c.lastname = "Smack"; 
      // I can not find or access this custom field when I go to create a contact. 
      c.new_customField = "Red Car"; 

이제 문제는, 내가 연락처 개체에 추가 한 사용자 정의 필드에 액세스 할 수 간단

. 내가 C#에서 연락처를 만들려고하고 모든 기본 필드는 사용자 정의 것들을 만들었습니다.

고맙습니다.

답변

3

자동 생성 서비스 참조를 사용 중입니다. CRM의 엔터티에 대한 변경 사항을 게시 (게시) 할 때마다 Visual Studio에서 서비스 참조를 업데이트하십시오.

+1

서비스 참조를 지속적으로 업데이트하지 않으려면 DynamicEntity 개체를 사용하고 그런 식으로 업데이트 할 수 있습니다. – Matt

+1

실제로 .. 단점은 단지 강력한 타이핑을 잃어 버리는 것입니다. 그러나 위쪽은 훨씬 더 많은 유연성과 일반적인 DynamicEntity에서 작동하는 특정 기능을 추상화하는 기능입니다. – PjL

0

솔루션 탐색기에서 웹 서비스 아래의 참조를 마우스 오른쪽 단추로 클릭하고 "웹 참조 업데이트"를 클릭하십시오. 이제 사용자 정의 옵션을 사용할 수 있습니다.