Thursday, 28 April 2011

CRM 4.0 Installation

Following is the Installation Procedure for CRM 4.0 :-

Start the Setup.exe

Choose weather you want to upgrade the setup or not
Type the Product Key
This message will come if you are using a Trial Key
 Click on I Accept the licence agreement
 Click on Install Prerequisites

 Choose Installation Type (Typical for Single Computer & Custom for Multiple Machines )
 Type the Name of SQL Server Instance
 Type the Organization name and Choose the Base Currency


 Choose the Website for CRM
 Type the Report Server url
 Choose the Organizational Unit (OU)
 Type the User Account (this account will be the System Administrator in CRM)
 Type the Name of Machine Hosting the Email Router




Installation Complete

CRM Web Service v/s CRM DLL

In CRM Web Services if you are making some changes in CRM Entities they will not get reflected until you will not update the Web Reference but In case of Dynamic Entity Class they will get effected immediately.

Please refer the following code :-
Lead Creation through CRM Web Service
Note : Please add you web reference first
=========================================
using System;
using System.Collections.Generic;
using System.Text;
using TestCRM.CrmSdk;
namespace TestCRM
{
    class Program
    {
        static void Main(string[] args)
        {
            CrmAuthenticationToken token = new CrmAuthenticationToken();
            token.AuthenticationType = 0;
            token.OrganizationName = "AdventureWorksCycle";
            CrmService svb = new CrmService();
            svb.CrmAuthenticationTokenValue = token;
            svb.Credentials = System.Net.CredentialCache.DefaultCredentials;
            //svb.Url = "http://crm/mscrmservices/2007/crmservice.asmx";

            lead l = new lead();
            l.subject = "From Normal Code";
            l.lastname = "Singh";
            l.firstname = "Kuldeep";
            l.companyname = "Koenig";
         
            Guid id = svb.Create(l);
            Console.WriteLine("Created");
            Console.ReadLine();
        }
    }
}

Lead Creation through CRM DLL’s
Note : Please Add you DLL references first
===========================================
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;


namespace Ch4_61_Example
{
    class Program
    {
        void abc()
        {
            CrmService svc=new CrmService();
            CrmAuthenticationToken token=new CrmAuthenticationToken();
            token.AuthenticationType=0;
            token.OrganizationName="AdventureWorksCycle";
            svc.CrmAuthenticationTokenValue=token;
            svc.Credentials=System.Net.CredentialCache.DefaultCredentials;
            DynamicEntity dyn = new DynamicEntity();
            dyn.Name = "lead";
            dyn.Properties.Add(CreateStringProperty("subject","New Lead using Dynamic Entity Class"));
            dyn.Properties.Add(CreateStringProperty("lastname", "Jones"));
            dyn.Properties.Add(CreateStringProperty("firstname", "Devi"));
            dyn.Properties.Add(CreateStringProperty("companyname", "Koenig"));
            dyn.Properties.Add(CreateStringProperty("salutation", "Dear,"));
            dyn.Properties.Add(CreateStringProperty("new_description", "Test dll"));
            TargetCreateDynamic target = new TargetCreateDynamic();
            target.Entity = dyn;
            CreateRequest req = new CreateRequest();
            req.Target = target;
            CreateResponse res = (CreateResponse)svc.Execute(req);
            Console.WriteLine("Created");
       
        }
        static void Main(string[] args)
        {
            
            new Program().abc();
            Console.ReadLine();
        }
        private Property CreateStringProperty(string Name, string Value)
        {
            StringProperty prop = new StringProperty();
            prop.Name = Name;
            prop.Value = Value;
            return prop;
        }
    }
}