C# 从SystemDateTime设置CrmDateTime
我有一个与MSCRM 4.0交互的应用程序。当我尝试 更新出生日期字段的步骤 联系人:我每天都会收到一条错误消息 时间错误每年都不同 当我尝试一种新的方式 那么 这个问题是在 下面的代码如何更新 我的新联系人生日 创造C# 从SystemDateTime设置CrmDateTime,c#,dynamics-crm,dynamics-crm-4,C#,Dynamics Crm,Dynamics Crm 4,我有一个与MSCRM 4.0交互的应用程序。当我尝试 更新出生日期字段的步骤 联系人:我每天都会收到一条错误消息 时间错误每年都不同 当我尝试一种新的方式 那么 这个问题是在 下面的代码如何更新 我的新联系人生日 创造 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; usi
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;
DateTime dt = new DateTime();
// set the date time to some date...
contact c = new contact();
c.firstname = "joe";
c.lastname = "Smack";
c.BirthDay = dt.ToString();
日期格式非常简单,使用固定格式转换,可能还包括您想要的时区
参考:日期格式非常简单,请使用固定格式进行转换,并可能包括您想要的时区
参考:您需要使用Technet上CRMDateTime类上的a CRMDateTime对象-文档: 此代码段也可能有帮助,例如:
您需要使用Technet上CRMDateTime类上的a CRMDateTime对象-文档: 此代码段也可能有帮助,例如:
CrmDateTime VariableName=CrmTypes.CreateCrmDateTimeFromUser(DateTime.Now)CrmDateTime VariableName=CrmTypes.CreateCrmDateTimeFromUser(DateTime.Now)