Menu Close

Category: Blog

DYNAMICS 365 INTEGRATION WITH WEB APPLICATION (ASP.NET) AND RETRIEVING DATA AND SHOWING IN GRID

Follow the steps as below:

First Create an ASP.NET WEBSITE from Visual Studio
Goto File> New > Website > Add a webform > 
then it will create an aspx page file then add a “GridView” to the aspx page. Inside the ASPX.CS class add the below code 

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net;
using System.ServiceModel.Description;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Query;


public partial class Accounts : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        IOrganizationService service = GetCRMService();
        QueryExpression query = new QueryExpression(“account”);
        query.ColumnSet.AllColumns = true;
        query.Criteria.AddCondition(“name”, ConditionOperator.NotEqual, “ksllls”);
        EntityCollection collection = service.RetrieveMultiple(query);

        DataTable dt = new DataTable();
        dt.Columns.Add(“name”);
        dt.Columns.Add(“accountnumber”);
        foreach(Entity entity in collection.Entities)
        {
            DataRow dr = dt.NewRow();
            dr[“name”] = entity.Attributes[“name”].ToString();
            if(entity.Contains(“accountnumber”))
            { 
            dr[“accountnumber”] = entity.Attributes[“accountnumber”].ToString();
            }
            dt.Rows.Add(dr);
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }


    public IOrganizationService GetCRMService()
    {
        string UserName = “mam@santechnology.onmicrosoft.com”;
        string Password = “devisri123”;
        ClientCredentials Credentials = new ClientCredentials();
        IOrganizationService Service;
        Credentials.UserName.UserName = UserName;
        Credentials.UserName.Password = Password;

        Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
        //This URI need to be updated to match the servername and organisation for the environment

        string CRMServer = ConfigurationManager.AppSettings[“crmserverurl”].ToString();
        Uri OrganizationUri = new Uri(CRMServer);
        Uri HomeRealmUri = null;

        // OrgaizationServiceProxy  ServiceProxy

        using(OrganizationServiceProxy ServiceProxy = new OrganizationServiceProxy(OrganizationUri,HomeRealmUri,Credentials,null))
        {
             Service = (IOrganizationService)ServiceProxy;
        }
        return Service;
    }
}

=======================================================================
 Screen shot of the Visual studio website application..

Account.aspx code:

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Accounts.aspx.cs” Inherits=”Accounts” %>

<!DOCTYPE html>

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
    <title></title>
</head>

<body>
    <form id=”form1″ runat=”server”>
    <div>
    <asp:gridview ID=”GridView1″ runat=”server”></asp:gridview>
    </div>
    </form>
</body>
</html>

=======================================================================
WEB.CONFIG CODE



<?xml version=”1.0″?>

<!–
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  –>

<configuration>
<appSettings>
  <add key =”crmserverurl” value=”https://santechnology.api.crm11.dynamics.com/XRMServices/2011/Organization.svc”/>
</appSettings>
    <system.web>
      <compilation debug=”true” targetFramework=”4.5″ />
      <httpRuntime targetFramework=”4.5″ />
    </system.web>


</configuration>

=======================================================================

The Output will be as shown on the screen shot:


=======================================================================

Here we go, then we will be able to see the accounts based on the queryexpression condition:

I hope this code might helps someone out there..

Happy CRM:-)
🔄

🔵🌹💮
Share this:

LIST OF CURRENT DYNAMICS 365 ONLINE REGIONS

 Here is a list of the current Dynamics 365 Online regions:
  • North America (crm.dynamics.com)
  • South America (crm2.dynamics.com)
  • Canada (crm3.dynamics.com)
  • EMEA (crm4.dynamics.com)
  • APAC (crm5.dynamics.com)
  • Australia (crm6.dynamics.com)
  • Japan (crm7.dynamics.com)
  • India (crm8.dynamics.com)
  • North America 2-for Government (crm9.dynamics.com)
  • United Kingdom (crm11.dynamics.com)
  • Microsoft Cloud Germany (crm.microsoftdynamics.de)
  • The above list accurate as of May 2017.

Share this:

MICROSOFT DYNAMICS CRM ONLINE VS ONPREMISE

The options of installing Dynamics CRM On Premises or going with CRM Online. In this post i have compared both platforms, and compared the differences.
Core Application Functionality
The core application functionality is at parity, with the same core application entities and extensibility features.
Extensibility
Customizations developed in a supported way for CRM on premise can be moved to CRM Online (and vice versa), and plugins, workflows and any custom extension can be used in either Online or On Premises deployments. Any supported code will work in both CRM online and On Premises.
Mobility
CRM clients for phone, tablet, and Outlook (including offline) work exactly the same between CRM Online and CRM On Premises.

Integrations with other Microsoft platforms

Integration with other Microsoft platforms such as Sharepoint, Exchange, Lync, and Yammer work with both CRM On Premises as well as CRM Online
If you currently use Office 365 for Exchange or SharePoint, CRM Online will allow you to standardize user management and offer enhanced server side integration with SharePoint Online, Exchange Online, and PowerBI.
Data Integration Options
Integration options are similar between CRM online and On Premises. Third party integration tools like Scribe Insight and SSIS with Kingswaysoft work with both CRM On Premises and CRM Online. Integration performance will vary based on the data loaded. Very large data integrations are typically faster with CRM On Premises if the integration server is close to the CRM server as latency is very low. CRM Online integration performance can be improved by optimizing the integration, using the bulk load API, or by reducing latency to the cloud by running the integration from a Microsoft Azure server.
Capability
CRM Online
CRM On Premises
Exchange Synchronization
CRM for Outlook, Email Router, or Server Synchronization (if using Exchange Online/O365)
CRM for Outlook, Email Router, or Server Synchronization (if using Exchange on premise)
SharePoint Integration
Server Side with SharePoint Online (if using O365)
Client-side integration
Inside View (Insights)
Included
Additional cost
Social Listening
Included
Additional cost
Workflows/dialogs
200
Unlimited
Custom Entities
300
Unlimited
SSRS Reporting
FetchXML, or T-SQL from a locally replicated reporting server
FetchXML or T-SQL
Power BI Reporting
Yes
No
Upgrade/Update process
Office 365 admin approves the upgrade before it is installed, update rollups applied automatically
Upgrades and update rollups installed my your administrator
Direct server access
No
Yes
Phone App
Yes
Yes if environment externally facing via ADFS
Tablet App
Yes
Yes if environment externally facing via ADFS
Storage
Limited to the amount of CRM Online storage purchased
Limited to the amount of storage available on your server
Release cycle
Two releases per year. Spring release functionality exclusive to CRM Online, so new functionality available online first.
Fall release released to both CRM Online and On Premises, includes the functionality released in the Spring release.
Migrating
CRM Online customers can migrate On Premises at any time. SQL database provided to client at scheduled time that can be imported to an On Premises deployment.
CRM On Premises customers can migrate to CRM Online and customization for entities can be imported; however, on premises database cannot be moved to Online data center, so a data migration is required.
Sandbox environments
CRM Online provides non production environments as part of your subscription that can be used for dev/test/UAT. The number of organizations received depends on the number of users.
Non production environments can be installed, depending on local server availability.
Share this: