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 = "h开发者_C百科ttp://" + 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
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.
Right click on the reference under web services in your solution explorer and click "Update Web Reference." The custom options should now be available.
精彩评论