Wednesday 29 April 2015

Dynamics CRM integration through c# - Create leads customers from your applications

You can add the necessary dll from SDK which is available on internet or Click Here.

The code which is given below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using System.ServiceModel.Description;
using System.Web.Services.Protocols;
using System.Runtime.Serialization;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Metadata;
using Microsoft.Xrm.Sdk.Query;

namespace WebAppWalkthrough
    public partial class _Default : System.Web.UI.Page

        private OrganizationServiceProxy _serviceProxy;
        private IOrganizationService _Orgservice;
        protected void Page_Load(object sender, EventArgs e)

        protected void btnSubmit_Click(object sender, EventArgs e)
                ClientCredentials cre = new ClientCredentials();
                cre.UserName.UserName = "";
                cre.UserName.Password = "PASSWORD";
                Uri serviceUri = new Uri("");
                OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, cre, null);
                IOrganizationService service = (IOrganizationService)proxy;
                Entity ent = new Entity("lead");
                ent.Attributes["firstname"] = txtLeadNAme.Text;
                ent.Attributes["subject"] = "Test by Aravind";
            catch (SoapException ex)

            catch (Exception ex)