创建联系人并更新自定义字段 MSCRM 4

发布于 2024-09-09 01:45:46 字数 1236 浏览 6 评论 0原文

这是我的代码示例...

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪眸﹌ 2024-09-16 01:45:46

您正在使用自动生成的服务参考。每当您对 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.

神回复 2024-09-16 01:45:46

右键单击解决方案资源管理器中 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文