Muhammad Ali Khan

MS CRM 3.0, MS CRM 4.0, Sharepoint 2007 & Sharepoint 2010

Me @ Microsoft CRM & Microsoft CRM Development Forums

Posted by Ali Khan on February 1, 2010

I am now, “Three” Star at the MS CRM’s Forums 🙂

image

CRM Threads:-

Advertisements

Posted in Personal | Leave a Comment »

Virtual Machine For SharePoint 2010

Posted by Ali Khan on January 27, 2010

Brief Description

This download contains a two Virtual Machine set for evaluating and demonstrating Office 2010 and SharePoint 2010.

System Requirements
  • Supported Operating Systems: Windows Server 2008 R2; Windows Server 2008 R2 Enterprise; Windows Server 2008 R2 Standard

In order to run this demo you will need the following: – Windows Server 2008 R2 with the Hyper-V role enabled. – Drive Formatting: NTFS – Processor: Intel VT or AMD-V capable – RAM: 8 GB or more recommended – Hard disk space required for install: 50 GB

Source:-  Microsoft SharePoint 2010 Virtual Machine

Posted in Sharepoint 2010, Sharepoint Foundation 2010 | Tagged: | Leave a Comment »

Using Business Connectivity Services(BCS) In SharePoint 2010 For Connecting To MS CRM 4.0

Posted by Ali Khan on January 24, 2010

In this post i will create a custom BCS .net connector (for SharePoint 2010) in Visual Studio 2010  to connect to MS CRM 4.0 and perform the basic CRUD(Create, Retrieve, Update, Delete) operations on the MS CRM “Account” Entity.

Source Code:- You can Download the Source Code of this Project From Here, Source Code.

Step 1:- Create a Custom .Net BCS Project In VS2010 For MS CRM 4.0

As First Step, Open VS 2010 (Beta 2 Ultimate Edition), Go to File==>New==>SharePoint 2010 ==> Business Data Connectivity Model Project.

Since VS2010 has the built in support for editing the application definition file, it will give me a nice GUI BDC Editor, After renaming the default “Entity1” and adding CRUD methods, it will look like this.

image

You can use the “BDC Method Details” window (the 2nd window in the above diagram) to create new Methods, as shown in the diagram below.

image

There is also the BDC Explorer on the right side. You can use the BDC Explorer to create “Methods In & Return Parameters” Here is how it look like.

image

Simply right click on the parameter name and click on “Add Type Descriptor” and then you can define the “Account” entity, as shown below.

image

If you want to use the VS2010 BDC Editor, Here is a good article as a starting point on how to use the editor (Building a BDC Model using the .NET Assembly Connector). But i personally like the XML Editor more as i find more flexibility in it. So to open the XML Editor, Right Click on your Model File (MSCRMBdcModel.bdcm) in “Solution Explorer” and click “Open With” a “XML Editor”  to bring the Model XML Editor.

image

Here is how it looks like.

image

And here is our “Account.cs” Entity.

image

And the Implementation of all the “CRUD” Methods from MS CRM 4.0 in “AccountService.cs”

image

Now from the Solution Explorer, right click and click “Deploy”, it will package the solution and deploy the External BCS Content Type on the your SharePoint 2010 site. (Remember to change the SharePoint site URL in the project properties window)

image 

This is how it looks like in the “Central Administration”. you can configure permission on it by click on the drop-down menu and select “Permission”.

image

Step 2:- Configure External Content Type Profile Page In Centeral Administration

Now go to Central Administration ==> Application Management ==> Service Application ==> Business Data Connectivity and click “Manage” from the top Ribbon. You will see the screen below,

image

Click “Edit” from the Ribbon and select “Configure” to configure the path for the “Profile Page” and click ok. See the diagram below.

image

Generate the profile page for the External Content Type “Account” by click on the dropdown ==> “Create/Upgrade Profile Page”.

image

So Now if you browse to any MS CRM Account with the above URL (e.g. http://win-1r2gn7r1jaq:8000/_bdc/MSCRMBdcModel_BdcModel1/Account_1.aspx?AccountID={ADE922F4-6C06-DF11-BF5A-001E8CFDD686}), you will get a profile page for the MS CRM Account as shown below.

image

Step 3:- Create a “External Content Type” List To Host MS CRM 4.0 Account

Browse to the site, where you deploy the solution, go to Site Actions==> More Options ==> List ==> “External List” ==> Create. Here Select the “External Content type”, as show below, and click “Create”.

image

Now the list will shows all the accounts from MS CRM 4.0, as shown below.

image

Off course you can always change the List View and remove the “AccountID”, as it is a Guid and there is no point in showing it to the end user. Here is how it looks like now.

image 

Step 4:-  Using SharePoint 2010 Designer to Create the “New”, Edit Form for our External Content Type

If you click on “Add new Item” now, it will throw an error because the create and edit page doesn’t exit for the list. So lets create the “New” & “Edit” form for our list in SharePoint 2010 Designer.

Open your site in SharePoint 2010 Designer ==> List and Libraries ==> click “CRM Accounts” (Your external list) to see the diagram below.

image

As you can see there are now “Create” and “Edit” Forms in the “Forms section”. So click “New” in the form section to open up the dialog box as shown below (for the “Create Account”) and click ok.

image

Do the same for the “Edit Account”, but this time select “Edit item form”, your forms section will now look like this.

image

Now click on the “EditAccount.aspx” page and modify the view. Here in SharePoint 2010 Designer, you can decide which field to show and which one to hide from the end user. Here is how the “EditAccount.aspx” looks like in SharePoint 2010 Designer (after editing). As you can see we have deliberately hide the “Account ID” (a Guid) and Parent Account (A MS-CRM Lookup) on the Edit Form.

image

Save the forms. Now browse to your list (MS CRM Accounts) in the SharePoint site. Here is how the “Create Account” looks like.

image

And Here is “Edit Account” and “Delete” option. You can see below the “Account ID” and “Parent Account” are not visible as we removed these field in the SharePoint 2010 Designer.

image

Oh Yes, and here is how it looks like in MS CRM 4.0

image

With this example, now you can perform all the basic operations CRUD( Create, Retrieve, Update, Delete) on MS CRM Account inside your SharePoint 2010 Portal, thus opening new opportunities for integration between MS CRM 4.0 and SharePoint 2010 Portal.

That’s all folks.

Posted in BCS, Bussiness Connectivity Services, MS CRM 4.0, Sharepoint 2010, SharePoint 2010 Designer, Sharepoint Foundation 2010 | Tagged: , | 13 Comments »

Add More Values to Duration(Drop-Down) In MS-CRM 4.0 Task Entity

Posted by Ali Khan on January 24, 2010

In this small post, i will show you how to add more options(Values) to the Standard “Duration” drop-down in the “Task” Entity. So, out of the box, the “Duration” field on the “Task” entity look like this.

image

Note:- “Duration” Field is not a MS CRM Pick-List. It is editable and user can add anything e.g. “4 Days”, “52 Minutes” etc. In fact the data type of the “Duration” field is “Integer”. but in Task entity it looks like a Standard MS CRM Pick list. In-Background MS CRM is generating a table for this field and displaying the values in the drop-down. See the attribute description below:-

image

So to add more values to the “Duration” drop-down, put the following JavaScript code in the Task Entity Form ==> OnLoad() event, save the form and publish the “Task” entity. The code is simply adding rows to the table, which is used to display the “Duration” drop-down on “Task” Entity Form.

var obj = document.getElementById('actualdurationminutesSelect');
var tbl = obj.childNodes[1];
var lastRow = tbl.rows.length;
var row = tbl.insertRow(lastRow);
var cell = row.insertCell(0);
cell.val = '4 days';
cell.innerText = '4 days';
lastRow++;
row = tbl.insertRow(lastRow);
var cell = row.insertCell(0);
cell.val = '5 days';
cell.innerText = '5 days';

After publishing the “Task” entity, the “Duration” drop-down now look like this, with values “4 days” & “5 days” coming inside the default drop-down.

 image

That’s all folks !!!

Posted in MS CRM 3.0, MS CRM 4.0 | Tagged: | 3 Comments »

Update Rollup 8 for Microsoft Dynamics CRM 4.0 is available

Posted by Ali Khan on January 21, 2010

INTRODUCTION

Update Rollup 8 for Microsoft Dynamics CRM 4.0 is available. This article describes the hotfixes and the updates that are included in this update rollup. This update rollup is available for all languages that are supported by Microsoft Dynamics CRM 4.0.

MORE INFORMATION

The build number of the update rollup packages for the Microsoft Dynamics CRM 4.0 server, for the Microsoft Dynamics CRM 4.0 client for Microsoft Office Outlook, and for the Microsoft Dynamics CRM 4.0 E-mail Router is 04.00.7333.2542.
The file names for the 32-bit versions of the update rollup packages are as follows:

  • CRMv4.0-KB975995-i386-Server-LangID.exe
  • CRMv4.0-KB975995-i386-Client-LangID.exe
  • CRMv4.0-KB975995-i386-Router-LangID.exe
  • CRMv4.0-KB975995-i386-DMClient-LangID.exe
  • CRMv4.0-KB975995-i386-SRS-LangID.exe
  • CRMv4.0-KB975995-i386-MUI-LangID.exe

The file names for the 64-bit versions of the update rollup packages for the Microsoft Dynamics CRM 4.0 server and for the Microsoft Dynamics CRM 4.0 E-mail Router are as follows:

  • CRMv4.0-KB9759952-amd64-Server-LangID.exe
  • CRMv4.0-KB975995-amd64-Router-LangID.exe
  • CRMv4.0-KB975995-amd64-SRS-LangID.exe
  • CRMv4.0-KB975995-amd64-MUI-LangID.exe

Source:- Rollup 8 Microsoft CRM

Posted in MS CRM 4.0 | 1 Comment »

Me @ Microsoft CRM & CRM-Development Forum

Posted by Ali Khan on January 14, 2010

image

CRM Threads:-

Posted in Personal | Leave a Comment »

Hurraah !!! Got A Seat For “25 seats for SharePoint 2010 Virtual Ignite GMT+4 Time zone: Limited”

Posted by Ali Khan on January 13, 2010

This week, i got an invitation from Microsoft for a Virtual Ignite Training On SharePoint 2010 from 25th to 29th Jan 2010.

image

Here is the event details :-

We have a rare opportunity available for partners in the Middle East, Africa and Europe to attend SharePoint 2010 Virtual Ignite in your time zone! 25 seats are open for the GMT+4 time zone for a 5 day Virtual Ignite training starting Jan 18, 2010. Given previous experiences, we expect the seats to go quickly and we will not be able to accommodate all requests to attend. There are two tracks…

Source:- http://tweetmeme.com/story/420479626/microsoft-sharepoint-team-blog-25-seats-for-sharepoint-2010-virtual-ignite-gmt4-time-zone-limited-availability-till-jan-9-2010

Really looking forward for the event.

Thanks Microsoft 🙂

Posted in Sharepoint 2010, Sharepoint Foundation 2010 | Leave a Comment »

Business Connectivity Services (BCS) Using WCF & SharePoint Designer 2010

Posted by Ali Khan on January 11, 2010

In this post, I will consume a simple WCF service in SharePoint 2010 Designer and create an external content type (formerly known as Entities in BCD).

Step 1:Create the WCF Service & Deploy In IIS

My First step is to create the WCF service. There is nothing fancy about the code, I have one simple “Project” Contract with CRUD methods defined (that later I will consume in BCS), these methods are using LINQ to SQL to my test SQL Server Database (ProjectDB). Here is the WCF Contract.

image

And here is its implementation

image

You can download the full code (along with the application definition file from here “Download Code, you can import this application definition file from the Central Administration).

Step 2: Create External Content Type In SharePoint Designer 2010 From WCF Service

After deploying the WCF service in IIS, now let’s move to SharePoint 2010 Designer and create the BCS External Content type from this WCF Service. Open any site in SharePoint 2010 Designer ==> Click External Content Types.

image

Click “External Content Type” in the Ribbon to create a new External Content type. Fill the “Name” and other properties as shown below.

image

Click the line “Discover external data source and define operations” and in the new screen, click “Add Connection” and select “WCF Service”.

image

Fill in the properties “Service Metadata URL”, “Service Endpoint URL” and namespace and the click ok. It will download the metadata from the WCF contract and generate the BCS External Content Type for you.

 imageAfter click ok, the external content type from WCF will look like this. Now you have to define the operations for this external content type.

image

Now one by one, you will generate the method for CRUD (Create, Retrieve, Update, and Delete) and Retrieve List. Here is the step by step procedure for the create method. Right click “Create” and select “New Create Operation”, a wizard will open up.

image

image

image

Now Click “Finish”, it will generate the “Create Method” for this external content type. Similarly, generate the method for other operations. Now your “External Content Type” will look like below,

image

Save the “External Content Type”, by pressing “Save Icon” in the SharePoint 2010 Designer at the top.

image

Step 3: Configure External Content Type Profile Page in Central Administration

Now go to Central Administration ==> Application Management ==> Service Application ==> Business Data Connectivity and click “Manage” from the top Ribbon. You will see the screen below,

image

Click “Edit” from the Ribbon and select “Configure” to configure the path for the “Profile Page” and click ok. See the diagram below.

image

Generate the profile page for the External Content Type “WCFProject” by click on the dropdown ==> “Create/Upgrade Profile Page”.

image

So Now if you browse to any project with the above URL (e.g. http://win-1r2gn7r1jaq:8000/_bdc/AliProjects_WCFSP2010/WCFProject_1.aspx?ProjectID=9e02b936-2d41-4031-a2f0-6b8e8c6367e8), you will get a profile page for the project as shown below.

image

Step 4: Displaying WCF Service Data In SharePoint List

Now we will create an “External List” to consume this data from WCF Service  as shown below.

image

image

Select the “External Content Type (WCFProject)” and click “Create” to create the list. It will pull the listings for all the projects from the WCF “ReteriveMultiple” Method as shown below.

image

Now you can “Create”, “Update”, “View” and “Delete” any “Project” and it will call WCF Method internally to perform the operation. See the example of the delete below.

image

Here is the “Create” form.

image

In Brief, With SharePoint 2010, now we can easily create connect our existing WCF Service with the SharePoint and display, edit,create and delete the data inside the portal.

That’s it :).

Posted in BCS, Bussiness Connectivity Services, Sharepoint 2010, SharePoint 2010 Designer, Sharepoint Foundation 2010, WCF | Tagged: | 11 Comments »

Throttling: New Features of List in SharePoint 2010 (Part 2/2)

Posted by Ali Khan on December 22, 2009

This is my 2nd post regarding the new features of lists in SharePoint 2010.

As we know, we could run into performance de-gradation and SharePoint Server Slow Response with List in SharePoint 2007 as the list of the size increases, because even though Microsoft recommended storing not more than 2000 list items for best performance, there was not enough performance monitoring & control from SharePoint 2007 itself. Now Performance Control & Monitoring has been applied on List in SharePoint 2010 through “Throttling”. So first let see what is throttling?

Throttling

Here is the throttling definition from Microsoft SharePoint Evaluation Guide.

“Through throttling settings, SharePoint Server 2010 provides a way for administrators to determine the level at which the server will go into throttling mode. Every five seconds, a job runs that checks server resources compared to configured levels. By default, Server CPU, Memory, Request in Queue, and Request Wait Time are monitored. After three unsuccessful checks, the server enters a throttling period and will remain in this state until a successful check is completed. Requests that were generated prior to the server’s entering throttling mode will be completed. This will, in theory, keep users from losing any current work when the server begins to throttle requests. Any new HTTP GET and Search Robot requests will generate a 503 error message and will be logged in the event viewer. While the server is in a throttling period, no new timer jobs will be started.”

Here is the link to the “SharePoint Evaluation Guide

Throttling On SharePoint 2010 Lists

 As the items in the SharePoint list continue to grow, the performance of the queries retrieving data from the list decreases. To help SharePoint users, Microsoft has provided different Performance Control checks through “Resource Throttling” on lists in SharePoint 2010.

In order to go to these settings, follow this path, Central Administration ==> Application Management ==> Manage Web Application. Once in the Web Application List, select the web application and click General Settings ==> Resource throttling. See the diagram below.

image

image

Here is a tabular representation of some of the important values and their description

Property Description Default Value
List View Threshold The number of results that can be returned in a user query. If the limit exceeds this value, an “Expensive Query Exception” is thrown in the code. Note this limit is for a normal user. Administrator limit can be configured to be much more than this. 5000
List View Threshold for Auditors and Administrators Same as above but for the administrator and power users and this value is considerably higher than the “List View Threshold” value. 20,000
Warning Level A Warning Level for the administrator that their list is close to the threshold. Note, this option is configured only through “Power Shell”

E.g. Use this power shell command to configure this value to 2500.

>> $sitecol = Get-SPSite http://mossserver:8000

>>$sitecol.WebApplication. MaxItemsPerThrottledOperationWarningLevel

= 2500

3000
List View Lookup Threshold Having a lot of lookup in a list also decreases the list performance. So this is the maximum no of lookups that a list can have. Having more lookups than this value mean the list is throttled. 6
Object Model Override This will allow the developers to override the property and ignore the throttling. E.g. SPQuery.RequestThrottleOverride & SPSiteDataQuery.RequestThrottleOverride will enable programmers to ignore the “throttling behavior” and get more items from the list than “List View Threshold”.

As administrator of SharePoint 2010, you have commands available through the Power Shell which can restrict a specific list from being queried through this model, thus users code can no longer ignore the “throttling” and the throttling Threshold value will be applied.

Yes
Daily Time Window for Large Queries This will allow the third party application (using super user or administrator credentials) to query the Large SharePoint 2010 List during off business time. Disabled

 

So with the above things in mind, how the following code (Retrieve all students from the “Student” list), will behave:-

image

Property Code Run in Context of Normal List User A (But Not SharePoint Administrator) Code Run in Context of User B (SharePoint Administrator)
List Items Count < “List View Threshold “ (5000),

i.e. <5,000

Code will run fine and return the required result. Code will run fine and return the required result.
List Item Count > “Warning Level” (2000)

i.e. >2000 but < 5000

No exception is thrown, code runs fine No Exception is thrown, code runs fine.
List Items Count > “List View Threshold”(5000) But Less than “List View Threshold for Auditors and Administrators” (20,000),

i.e. >5,000 but < 20,000

A Expensive Query Exception is thrown No Exception is thrown, and the code will return the required result.
List Items Count > “List View Threshold for Auditors and Administrators”(20,000),

i.e. >20,000

A Expensive Query Exception is thrown A Expensive Query Exception is thrown
During Time of Daily Time Window for Large Queries. Query threshold not applied, query runs fine even if the threshold limit is exceeded. Query threshold not applied, query runs fine even if the threshold limit is exceeded.
Object Model Override = true and RequestThrottleOverride is overridden Exception thrown if list is throttled, this property cannot be overridden by a normal user. No exception thrown, even if the list is throttled (i.e. Items Count >20,000)

 

Some Useful Power Shell Commands

How to? Example
Set the maximum threshold warning value for the web application  $sitecol = Get-SPSite http://mossserver:8000

$sitecol.WebApplication. MaxItemsPerThrottledOperationWarningLevel

= 2500

This command will save all the list possible commands to a file on C:\ drive. $sitecol.RootWeb.Lists | select * >> c:\listcmd.txt
Get a reference to the list $list = $sitecol.RootWeb.Lists[“Student”]
Is List Throttled $list.IsThrottled
Is Throttling on list is enabled or not. $list.EnableThrottling
Returns the maximum throttled threshold value (for administrator) $sitecol.WebApplication.MaxItemsPerThrottledOperation
Return the maximum throttled threshold value (for normal user). $sitecol.WebApplication.MaxItemsPerThrottledOperationOverride
Maximum lookup field allowed in a list. $sitecol.WebApplication.MaxQueryLookupFields

 

Briefly, Throttling allows realistic limit on the number of items that can be or should be queried from a SharePoint 2010 List. Although you can store the million of item in a SharePoint list, but the query operation will become slower as the size of the list grows. By allowing throttling, SharePoint 2010 has now help developers & especially Farm Administrators to control the large list & large list queries so that the performance of the whole SharePoint farm doesn’t decrease.

Posted in Sharepoint 2010, Sharepoint Foundation 2010, Throttling List | Tagged: | 3 Comments »

New Features of List in SharePoint 2010 (Part 1/2)

Posted by Ali Khan on December 20, 2009

In this post, I will describe some of the new things introduced with lists in SharePoint 2010.

Some of these things are

1. Referential Integrity:-

As you know, with SharePoint 2007 we can create relationship between lists using Lookup field. But now, List in SharePoint 2010 also supports Referential Integrity with another list. So if you have two lists Student and Department, you can create a referential integrity constraint (Cascade Delete or Restrict Delete) between them.

  1. Cascade Delete: Means if item in the parent list is deleted all the associated items in the child list will also be deleted (just like in SQL Server)
  2. Restrict Delete: If an item in parent list is associated to items in the child list, then this item in parent list cannot be deleted unless its association with all the items from the child list is removed.

Here in below example, I have created two List “Student” & “Department”. And now I am creating a relationship between “Student” and “Department”. For this I have to create a column in “Student” list. See the diagram below. (Also see the referential integrity constraint between the two list set to “Restrict Delete”, which means the “Department” cannot be deleted if there are one or more “Student” related to it, just like between any two SQL tables).

image

 

2. Projected Fields in Lists:-

These are fields from the parent list which will appear in the view of the child list. These are additional fields from the parent list to be shown in the child list. E.g. from the above diagram, Department Location from the department will be shown in the student list. These fields are NOT saved in the child list (Student) and will be only shown in the child list. See the diagram below. Here the “Department Location” is a “Project Field” from the “Department” list to be shown in the “Student” list, but it is not saved in the “Student” list.

image

image

3. Unique Columns:-

You can create unique column (meaning the column will hold the unique data) inside a list in SharePoint 2010. The unique column MUST be indexed. So while creating the unique column, SharePoint 2010 will ask you to index the Unique Column. E.g. Student “Registration No” can be a unique column in the “Student” list. You can also make any existing column as unique column provided it has unique data for all the list items.

4. JOIN and Querying Data from Two Lists:-

Developers can query the SharePoint 2010 List using CAML and LINQ to SharePoint and select fields from two different lists as shown in the code below. Here in the below code ( LINQ To SharePoint), I have retrieved all the “Students” for the Department “Computer Science”.

Note: – In order to use LINQ to SharePoint you have to generate the “SharePoint Context” from the SPMetal tool (now comes as a part of SharePoint 2010), which is located at the following directory. (“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN”). Here is syntax to generate your Context.cs file.

SPMetal /web:http://mossserver:8000 /namespace:SPTeamSite /code:SPTeamSite.cs

After this create a new project in VS2010, add the reference to Microsoft.SharePoint.Linq.dll & Microsoft.SharePoint.dll located at the following directory. (“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI”). Also add the SPTeamSite.cs file generated from the SPMetal tool. See the diagram below.

image

Now here is the code to retrieve all the “Students” of a particular “Department”.

image

image

Lists in SharePoint 2010 have a lot more to offer. I will do more posting on the new features of Lists in SharePoint 2010 as I learn more about it.

Cheers 🙂

Posted in Sharepoint 2010, Sharepoint Foundation 2010 | Tagged: | 2 Comments »