locked
plz plz plz help me!!!!!! RRS feed

  • Question

  • Provide me the c#.net Windows application code  or Web application in C#.net

    Create a contact with following values :

    First name:
    Last Name:
    Address:
    Mobile number

    Thursday, November 5, 2009 4:55 AM

Answers

  • Hi,

    You could find many sample codes in the sdk itself.
    You could refer to them.

    Here you add references to Microsoft.Crm.Sdk and SdkTypeProxy dll to your application.

    You could use the code below !

    CrmService crmService = new CrmService();
                crmService.CrmAuthenticationTokenValue = new Microsoft.Crm.Sdk.CrmAuthenticationToken();
                crmService.CrmAuthenticationTokenValue.AuthenticationType = 0;
                crmService.CrmAuthenticationTokenValue.OrganizationName = "orgname";
                crmService.Url = "http://servername:(port)/mscrmservices/2007/crmservice.asmx";
                crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
    
                contact myContact = new contact();          
                myContact.firstname = "firstname";
                myContact.lastname = "lastname";
                myContact.address1_city = "city";
                myContact.mobilephone = "9876500444";
                crmService.Create(myContact);
    Regards,
    Nishant Rana

    http://nishantrana.wordpress.com
    Thursday, November 5, 2009 6:20 AM