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#創建一個聯繫人,並且我創建的所有基本字段都不是自定義字段。
謝謝
爲了避免不斷更新服務引用,您也可以使用DynamicEntity對象並以這種方式進行更新。 – Matt 2010-07-13 11:38:31
事實上..缺點就是你失去了強大的打字能力......但是好處是靈活性更大,並且能夠抽象出在普通DynamicEntity上運行的某些功能。 – PjL 2010-07-13 13:25:53