views:

79

answers:

2

Hello,

 I have an application that interacts with MSCRM 4.0.  When I try

to update the date of birth field on a contact I get an error message every time. The error is different every time I try a new way... So the question is in the context of the following code how do I update the BirthDay on the new contact I am about to create?

Thanks!

///////////

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();
A: 

The date format is very pick, convert it using a fixed format, and maybe include the timezone that you want...

Ref. : http://geekswithblogs.net/shauryaanand/archive/2007/07/27/114220.aspx

Mercure Integration
A: 

Hi, you need to be using the a CRMDateTime object - docs on the CRMDateTime class on Technet:

http://technet.microsoft.com/en-us/library/aa613542.aspx

This code snippet may also help as an example:

http://mahenderpal.wordpress.com/2010/04/15/set-crm-datetime/

ABC123