创建联系人并更新自定义字段 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# 创建联系人,并且创建了所有基本字段,但不是自定义字段。
谢谢
Here is my code sample...
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";
Now the problem is simple, I can not access any of the custom fields I have added to the contact object. I am trying to create a contact from C# and I have all of the base fields created just not the custom ones.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在使用自动生成的服务参考。每当您对 CRM 中的实体进行(和发布)更改时,请更新 Visual Studio 中的服务引用。
You're using the auto-generated service reference. Update the service reference in Visual Studio whenever you've made (and published) changes to your entities in CRM.
右键单击解决方案资源管理器中 Web 服务下的引用,然后单击“更新 Web 引用”。自定义选项现在应该可用。
Right click on the reference under web services in your solution explorer and click "Update Web Reference." The custom options should now be available.