Skip to main content

Posts

Showing posts with the label Dynamics CRM 3.0 API

SharePoint 2007 Integration With Dynamics CRM - Solution - Part 2

OK, here's the Part 2 of the solution I proposed here . We will develop a custom Web part which will display number of application forms in CRM posted from SharePoint Web site in the form of Key Performance Indicator – assume there is a target for number of application forms. We will also assume for this sample that the application form in our case will be the task which we create in CRM when new application is submitted from the SharePoint Web site. Solution 1. Create a Web part and add the Web Reference to point to the CRM Server Web Service. For CRM 3.0 it will be http://your_server:5555/mscrmservices/2006/crmservice.asmx, for CRM 4.0 it will be http://your_server:5555/mscrmservices/2007/crmservice.asmx 2. Add the following properties to the Web part class: private string _sCrmWebUrl = ...; [Personalizable(PersonalizationScope.Shared), WebBrowsable(true), WebDisplayName("CRM Web Server URL"), Category("Custom Properties")] public string CrmWebUrl { get...

Dynamics CRM API - Essentials

Here is the information about how to create certain type of entities in Dynamics CRM 3.0 using API. For version 4.0 could be some changes and they will be pointed out specifically. Create a contact public Guid CreateContact() { CrmService service = new CrmService(); service.Url = ...; service.Credentials = System.Net.CredentialCache.DefaultCredentials; Guid gResult = Guid.Empty; try { contact mycontact = new contact(); mycontact.firstname = ...; mycontact.lastname = ...; ... // provide other attributes gResult = service.Create(mycontact); } catch (System.Web.Services.Protocols.SoapException soapex) { ... } catch (Exception ex) { ... } return gResult; } Create a task in regard to the contact private Guid CreateActivityForContact(Guid gContactId) { Guid gResult = Guid.Empty; CrmService service = new CrmService(); service.Url = ...; service.Credentials = Syst...

Dynamics CRM API: QueryExpression In Use

During the recent SharePoint 2007 and Dynamics CRM 3.0 integration project I have come across the issue using QueryExpression class of Dynamics CRM API. Consider the following scenario: 1. We need to search for the contact in CRM using API and following criteria: contact first name and last name are equal to the values provided by search functionality or email is equal to the value provided by search functionality - email = email_value OR (first name = first_name_value AND last name = last_name_value) 2. If contact exists then we just use the identifier to do something with that contact if not exists - create the contact Initially I wrote the following code to retrieve the desired contact: string sEmail = ...; // initialize email value string sFirstName = ...; // initialize first name string sLastName = ...; // initialize last name try { QueryExpression queryContact = new QueryExpression(); queryContact.EntityName = "contact"; queryContact.ColumnSet = new AllColum...