Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home CSharp Create Account With Microsoft Dynamics CRM Web Services By C#

Create Account With Microsoft Dynamics CRM Web Services By C#

After create a CrmService with your organization, server, domain, username and password information, I continue to create this tutorial to show you how to create an Account by using Microsoft Dynamics CRM Web Services.

If should read this tutorial on my site to know how to create a CrmService if you haven’t read it yet.

I will re use the IFDConnectionDemo function in the previous tutorial to create CrmService Web service connection.

The CrmService Web service provides a set of methods, this tutorial will give an example for Create method.

The C# source code below will:

  • Create a CRM Service instance
  • Create an Account entity and assign data to some attributes
  • Call the Create method to create the Account
  • Display the new Account GUID (Account ID)

Here you go – file create_account.aspx in the source code attachment:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using Microsoft.Crm.Sdk;
using Microsoft.Crm.Sdk.Query;
using Microsoft.Crm.SdkTypeProxy;
using CRM;
 
public partial class create_account : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string organization = "your-organization";
        string server = "your-server:your-port-number-if-any";
        string domain = "your-domain";
        string username = "your-username";
        string password = "your-password";
 
        //Create CRM Service instance
        CrmService service = crm_demo.IFDConnectionDemo(organization, server, domain, username, password);
 
        //Create Account entity and assign data to some attributes
        account newAccount = new account();
        newAccount.name = "Hoan Huynh";
        newAccount.accountnumber = "123456";
        newAccount.address1_postalcode = "98052";
        newAccount.address1_city = "HCM";
        newAccount.emailaddress1 = "[email protected]";
        newAccount.address1_telephone1 = "089666541";
        newAccount.description = "Some note here ...";
        newAccount.telephone1 = "0909345541";
 
        // Call the Create method to create the account.
        Guid accountId = service.Create(newAccount);
 
        //Display the new Account GUID (Account ID)
        Response.Write("accountId: " + accountId.ToString() + "<br>"); //0b00108f-8757-e011-a444-e61f13c072b3
    }
}

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.Crm.Sdk; using Microsoft.Crm.Sdk.Query; using Microsoft.Crm.SdkTypeProxy; using CRM; public partial class create_account : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string organization = "your-organization"; string server = "your-server:your-port-number-if-any"; string domain = "your-domain"; string username = "your-username"; string password = "your-password"; //Create CRM Service instance CrmService service = crm_demo.IFDConnectionDemo(organization, server, domain, username, password); //Create Account entity and assign data to some attributes account newAccount = new account(); newAccount.name = "Hoan Huynh"; newAccount.accountnumber = "123456"; newAccount.address1_postalcode = "98052"; newAccount.address1_city = "HCM"; newAccount.emailaddress1 = "[email protected]"; newAccount.address1_telephone1 = "089666541"; newAccount.description = "Some note here ..."; newAccount.telephone1 = "0909345541"; // Call the Create method to create the account. Guid accountId = service.Create(newAccount); //Display the new Account GUID (Account ID) Response.Write("accountId: " + accountId.ToString() + "<br>"); //0b00108f-8757-e011-a444-e61f13c072b3 } }

I captured some screen for you can preview the result:

1. Display Account ID

Microsoft Dynamics CRM Web Services Account ID

Microsoft Dynamics CRM Web Services Account ID

2. Result for Account Page:

Microsoft Dynamics CRM Web Services Account Page

Microsoft Dynamics CRM Web Services Account Page

3. Result for Account General Information Page:

Microsoft Dynamics CRM Web Services General Information

Microsoft Dynamics CRM Web Services General Information

4. Result for Account Detail Information Page:

Microsoft Dynamics CRM Web Services Detail Information

Microsoft Dynamics CRM Web Services Detail Information

Download the source code above

Mar 26, 2011Hoan Huynh
Create CrmService with Domain, Username And PasswordView Word Wrap and Line Numbers in Microsoft Visual Web Developer 2010 Express
You Might Also Like:
  • Retrieve Account With Microsoft Dynamics CRM Web Services By C#
  • Create And Assign Account To A User In Microsoft Dynamic CRM With C#
  • Dymanic Crm Error 401 Unauthorized When Create Or Retrieve Account And Contact
  • Create CrmService with Domain, Username And Password
  • Get Familiar With Microsoft Dynamics CRM Development Customization Levels
  • Property or indexer ‘Microsoft.Crm.Sdk.Query.ColumnSet.Attributes’ cannot be assigned to – it is read only
  • Install ASP On Microsoft Windows Server 2008 IIS 7.0 and IIS 7.5
  • PHP Login Or Sign In With Google Account By OpenID
  • Property or indexer ‘Microsoft.Crm.Sdk.Query.FilterExpression.Conditions’ cannot be assigned to – it is read only
  • Create Amazon CloudFront With Your Own Domain And Own Files Server
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

11 years ago CSharpCrmService, CrmService.Create, Microsoft, Microsoft Dynamics CRM, SDK857
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,444 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,824 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,638 views
JQuery Allow only numeric characters or only alphabet characters in textbox
14,981 views
C# Read Json From URL And Parse/Deserialize Json
11,693 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development