Microsoft Dynamics CRM Version 4.0 Contextual Document Libraries
Steps to follow:
Step 1: We need to add a custom attribute to the Account entity, these attributes are used to store the location of the contextual document library URL and folders that we create via the plug-in. Create the following attribute for the Account entity:
New_sharepointdocumentlibraryurl: nvarchar – allow a reasonable length for the URL (300) value
Step 2: Save the changes
Step 3: Publish the changes so that the CRM web services are up to date with our new attributes.
Step 4: Create a class library project in Visual Studio to create our CRM 4.0 Plug-In component for the Account Create transaction (call project – AccountCreatePlugin and rename cs file to UpdateAccountCreate.cs.
Step 5: Add a web reference for SharePoint (call it SharePoint), typically this is lists.asmx and there may be a number of these web service endpoints due to multiple SharePoint sites on your designated server. SharePoint is designed so that the web services are virtualized at every site level. All of the web services binaries are located in the
Step 6: Add references to the following dll’s: Microsoft.crm.sdk.dll and Microsoft.crm.sdktypeproxy.dll, these are found in the bin folder where you have unpacked the crm sdk. Add another reference to system.web.services into your project.
Step 7: Ensure you are editing the main class file in your project.Look through this code and make sure you change any System.Net.NetworkCredential to a valid username, password and domain (this has already been completed for you). Also look through the code for any references to yoursharepointservername and change this to a valid server name for your SharePoint location (this has already been completed for you). Add the code below to your class file
public class UpdateAccountOnCreate : IPlugin
#region IPlugin Members
public void Execute(IPluginExecutionContext context)
//First we’ll grab the name of our account and its GUID
DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties[ParameterName.Target];
string accountName = entity[”name”].ToString();
string accountId = context.OutputParameters.Properties[”id”].ToString();
//SharePoint Document Libraries have a type code of 101
Int32 spDocLibraryListType = 101;
//Call the SharePoint Web Service to create a document library
Lists listService = new Lists();
listService.Credentials = new System.Net.NetworkCredential(”administrator”, “pass@word1″, “litwareinc”);
System.Xml.XmlNode SPresult = listService.AddList(accountName, accountName + ” Document Library”, spDocLibraryListType);
//grab the return xml
string returnXml = SPresult.InnerXml.ToString();
//Now we’ll update our account record with the URL of the contextual SP library
DynamicEntity account = new DynamicEntity();
account.Name = EntityName.account.ToString();
account[”accountid”] = new Key(new Guid(accountId));
account[”new_sharepointdocumentlibraryurl”] = “http://localhost:7777/” + accountName + “/Forms/AllItems.aspx”;
//Using the iPlugIn interface we create a reference to the CrmService web service
ICrmService service = context.CreateCrmService(true);
Step 8: Sign your dll
}Step 9: Compile your new plug-in component.
Step 10: Copy the compiled plug-in assembly AccountCreatePlugin.dll to the
Step 12: Register this plug-in with the platform – this is available from Tool in VS (see SDK for more info). You can either register this synchronously or asynchronously
Step 12 a: Register Step with the platform (message = create, entity = account) then register
Step 13: We now need to configure the iFrames in the Account entity to display our contextual document libraries or folders. Add a new tab called Document Library and then add a new iFrame called IFRAME_SharePoint
Step 14: Next we want to add in the OnLoad logic on the Account form to set the URL of the SharePoint iFrame to display our contextual document library.
// OnLoad Event to set the iFrame URL for the SharePoint Library.
var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;
// Set SharePoint Document Library
// we’ll update the iFrame src property if this is an update form
if (crmForm.FormType == CRM_FORM_TYPE_UPDATE)
crmForm.all.IFRAME_SharePoint.src = sUrl;
Step 15: Save the changes to the Account Entity.
Step 16: Publish changes
Step 17: Create a new account record
May 15, 2008 | Leave a Comment
(1) Open Internet Explorer.
(2) Select TOOLS >> INTERNET OPTIONS >> SECURITY Tab.
(3) Choose the “CUSTOM LEVEL” button.
(4) Within the Settings change “USER AUTHENTICATION” to “Prompt for user name and password”
(5) Choose OK >> APPLY.
(6) Close Internet Explorer.
The next time you go to log into CRM via the Internet Explorer, you should be prompted to enter in your username and password.
May 2, 2008 | Leave a Comment
Microsoft Corp. today announced that Profiles International Inc., which provides Web-based employee-assessment and talent management solutions to companies across the globe, has chosen Microsoft Dynamics CRM to replace its Pivotal CRM software.
The new Microsoft technology replaces the company’s CDC Software Pivotal CRM, Pivotal ePartner portal, Pivotal MarketFirst electronic marketing application and basic intranet site. Profiles International evaluated software from Oracle’s Siebel, Salesforce.com, SAP, Sage CRM Solutions, Netsuite Inc. and CDC’s Pivotal before selecting the Microsoft Dynamics solution.
For more information on this visit: [Microsoft PressPass]