Logo
Lose Weight
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Server

Microsoft Dynamics CRM 4.0 : SharePoint Integration - Custom SharePoint Development

2/18/2013 6:41:34 PM

Microsoft has provided two very extendable frameworks: the Microsoft SharePoint and the Microsoft CRM APIs. The two systems have a lot of their APIs exposed (the details can be found on the MSDN site), which can allow developers to automate business processes for nearly every business permutation. (See, for example, Figure 1.) The APIs for both systems enable developers to accomplish numerous things. For example, an application can be created to trigger a forms-based workflow inside SharePoint when an attribute changes in Microsoft Dynamics CRM. The possibilities are endless via custom development.

Figure 1. Custom web part showing CRM data on Live Search Maps with Cisco integration.


The Microsoft Dynamics CRM (http://msdn.microsoft.com/en-us/library/bb928212.aspx) SDK contains architectural information about the entity and security model. The SDK also contains sample code for the following features:

  • Server-side code

  • Custom business logic

  • Integration modules

  • Workflow assemblies

  • Customizing the web client using scripting

  • Reference for the user interface style guide

The Microsoft SharePoint APIs (http://msdn.microsoft.com/en-us/library/ms441339.aspx) enable developers to create modules for the following components:

  • The server-side object model allows developers to interact with the MOSS and WSS components directly (for example, populating data in Microsoft Dynamics CRM after a series of approvals on the data stored in a SharePoint list).

  • The web services definition is the recommended mode of communication with Dynamics CRM and SharePoint.

  • The Collaborative Application Markup Language (CAML) is an optimized way of retrieving data from SharePoint.

  • You can use workflows to encapsulate business processes that can be attached to SharePoint lists in Windows SharePoint services.

  • The Create Custom Field Types option is a way to store custom data types inside SharePoint for further integration (for example, creating a data type for a geographic information system (GIS), also known as a maps integration).

  • Search APIs provide direct access to the query objects and Query web service to retrieve search results.

To expedite web part development, Microsoft has provided a starter kit for the following development environments:

Open Visual Studio and create a new project using the WebPart template. This will create a basic web part shell, with a deployment package. The basic WebPart template has the following code inside it:

using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;


using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;


namespace WebPart1
{
    [Guid("e499bfed-b3d8-4bcf-9d03-642337145800")]
    public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
    {
        public WebPart1()
        {
        }


        protected override void CreateChildControls()
        {
            base.CreateChildControls();


            // TODO: add custom rendering code here.
            // Label label = new Label();
            // label.Text = "Hello World";
            // this.Controls.Add(label);
        }
    }
}

					  

Using the basic template, you can just enter the following lines of code inside the Render function. The following lines of code will show a list of accounts, where the account name starts with ExtraTeam (as shown in Figure 2):

CrmSdk.CrmAuthenticationToken authToken = new CrmAuthenticationToken();
authToken.OrganizationName = "MicrosoftCRM";


CrmSdk.CrmService crmService = new CrmSdk.CrmService();
crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
crmService.CrmAuthenticationTokenValue = authToken;


QueryExpressionHelper qeHelper = new
QueryExpressionHelper(EntityName.account.ToString());
qeHelper.Columns.AddColumn("name");
qeHelper.Criteria.Conditions.AddCondition("name", ConditionOperator.Like, "ExtraTeam%");


BusinessEntityCollection accountsRetrieved =
service.RetrieveMultiple(qeHelper.Query);


foreach (account accountItem in accountsRetrieved.BusinessEntities)
     writer.Write(accountItem.name + "<BR>");

					  

Figure 2. Custom web part showing CRM data.

Note

It is recommended to separate the application into separate functions and classes based on the requirements.

Other -----------------
- Windows Server 2008 R2 file and print services : Administering Distributed File System Services (part 2) - Configuring and administering DFS Replication
- Windows Server 2008 R2 file and print services : Administering Distributed File System Services (part 1) - Configuring and administering DFS Namespaces
- Customizing Dynamics AX 2009 : Number Sequence Customization
- Microsoft Systems Management Server 2003 : Queries (part 3) - Executing Queries
- Microsoft Systems Management Server 2003 : Queries (part 2) - Creating a Query
- Microsoft Systems Management Server 2003 : Queries (part 1) - Query Elements
- Microsoft Systems Management Server 2003 : Custom SMS Administrator Consoles
- System Center Configuration Manager 2007 : Operating System Install Packages and Image Packages (part 2) - Manual Image Creation, Image Deployment
- System Center Configuration Manager 2007 : Operating System Install Packages and Image Packages (part 1) - Automated Image Creation and Capture
- System Center Configuration Manager 2007 : Operating System Deployment - Computer Associations
- Microsoft Exchange Server 2007 : Load Balancing in Exchange Server 2007
- Microsoft Exchange Server 2007 : Managing a Windows Server 2003 Cluster
- BizTalk Server 2009 : Editing and Resubmitting Suspended Messages (part 2) - Pseudo-Walkthrough to Perform Edits and Resubmits
- BizTalk Server 2009 : Editing and Resubmitting Suspended Messages (part 1) - Sample Flows for Edit and Resubmit
- BizTalk Server 2009 : Building a Resequencing Aggregator
- Windows Server 2003 on HP ProLiant Servers : Security Planning and Design (part 3) - Microsoft Software Update Service and Windows Update Service
- Windows Server 2003 on HP ProLiant Servers : Security Planning and Design (part 2) - Account Lockout
- Windows Server 2003 on HP ProLiant Servers : Security Planning and Design (part 1)
- Developing with SharePoint 2010 (part 4) - Developer Toolbar
- Developing with SharePoint 2010 (part 3) - Server Object Model
 
 
Most view of day
- Sharepoint 2013 : Branding with the Design Manager (part 2) - Creating a Brand
- Developing Disk Images : Creating the Lab Deployment Point
- SharePoint 2013 : Health and Monitoring (part 3) - Analytics, The Health Analyzer
- Windows Server 2012 : Ensuring DHCP availability (part 2) - Implementing DHCP failover
- Windows Server 2003 on HP ProLiant Servers : Logical Structure Design (part 2) - Forest Structure, OU Structure
- Microsoft Exchange Server 2007 : Consolidating a Windows 2000 Domain to a Windows Server 2003 Domain Using ADMT (part 1) - Modifying Default Domain Policy on the Target Domain
- Windows Server 2003 on HP ProLiant Servers : File and Print Services, Selection of ProLiant Servers for the Enterprise
- Maintaining Security : Authorizing Administrative Actions, Restricting Access to Web Content
- Microsoft Lync Server 2013 : Configuring the Director (part 1) - SRV Records, Web Services FQDN Overrides
- Windows Phone 8 : Configuring Mailbox Settings (part 1) - Linking Mailboxes
Top 10
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
- MDT's Client Wizard : Application Properties
- MDT's Client Wizard : Operating System Properties
- MDT's Client Wizard : Customizing the Deployment Share
- Windows Server 2012 : Software and User Account Control Administration (part 5) - Maintaining application integrity - Configuring run levels
- Windows Server 2012 : Software and User Account Control Administration (part 4) - Maintaining application integrity - Application access tokens
- Windows Server 2012 : Software and User Account Control Administration (part 3) - Mastering User Account Control - Configuring UAC and Admin Approval Mode
- Windows Server 2012 : Software and User Account Control Administration (part 2) - Mastering User Account Control - Elevation, prompts, and the secure desktop
- Windows Server 2012 : Software and User Account Control Administration (part 1) - Software installation essentials
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro