Posts Tagged ‘SharePoint2010’

How to replace the SharePoint date calendar control with more user friendly jQuery calendar control

April 26, 2014 1 comment

When you use the SharePoint date and time type for date of birth field, you will notice that the calendar control is extremely non-user-friendly. You can only navigate month by month as shown below. To resolve the issue, you can customize the list form page using SharePoint designer and replace the OOB calendar control with popular jQuery control. The solution works for both SharePoint 2010,2013 and office365.

Here are the steps for how to achieve this.

1. Open SharePoint designer and create a New List Form called customNew and set as default form for the selected type.

2. Open style library in file explorer and copy jQuery and jQuery UI files into the style library in SharePoint site.

You can download the jQuery and jQuery UI from the web and the content of the contactPersonCustomNewForm.js is as below. I use the dd/mm/yy format as my locale in Regional Settings is English(New Zealand). You need to change this if you live in another country with different date format

$(document).ready(function() {
		    showOn: "button",
			buttonImage: "/_layouts/images/calendar.gif",
			buttonImageOnly: true,
			yearRange: "c-20:c+20",
			dateFormat: "dd/mm/yy"

In order to get the image and textbox selector above , you can open IE developer toolbar(click F12) and find the control ID as below:

3. Open SharePoint designer and edit the newly created New List Form customNew.aspx in advance mode. Then copy and paste the following links in the PlaceHolderAdditionalPageHead.

	<SharePoint:CssRegistration name="<%$SPUrl:~SiteCollection/Style Library/themes/ui-lightness/jquery-ui.css%>" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-1.10.2.js" Defer="false" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-ui-1.10.4.custom.min.js" Defer="false" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/contactPersonCustomNewForm.js" Defer="false" runat="server"/>


4. Now go to the list and click add, you will see the new calendar control as shown below

How to create Office365 SharePoint site using SharePoint2010 template

July 15, 2013 1 comment

Recently, I worked with a client that has office 365 upgraded to SharePoint 2013.But they still like to create the SharePoint site using the old SharePoint2010 template, if you like to know how , here are the steps:

1. Go to your Office 365 portal and then go to the SharePoint admin page.

2. Next, click settings page.

3. Change the Global experience Version Settings.

4. Finally, you will be able to create SharePoint site using 2010 template.

How to copy items using Nintex Workflow

June 11, 2013 1 comment

Nintex does not offer copying items from one SharePoint library to another out of box. However, it is not hard to implement one yourself. You can use the copy.asmx web services to achieve this. Here are the steps below and you can download the source here

1. Create a UDA with the following parameters:

2. Call the copy.asmx service to copy the item from SouceItemUrl to DestinationItemUrl

3. If your destination document library has versioning and check-in/out turned on , you can use list.asmx to check in your file as below:

4. You need to create constant of Credential type named SP_WORKFLOW_WS as below

5. Here is how it looks like in the Workflow designer.

6. To call this UDA, you can perform the following in your workflow

How to write PowerShell code part 4 (using loop)

May 31, 2013 Leave a comment

In this post, I’d like to show you how to loop through the xml element. I will use the list data deletion script as an example. You can download the script here.

1. To perform the loop, I use foreach in powershell. Here is my xml looks like

<?xml version="1.0" encoding="utf-8"?>
<Site Url="http://workflowuat/npdmoc">
 <List Name="YBBEST Collaboration Areas" Type="Document Library"/>
 <List Name="YBBEST Project" />
 <List Name="YBBEST Document"/>

2. Here is the PowerShell to manipulate the xml. Note, you need to get to the $configurationXml.Site.Lists.List variable rather than $configurationXml.Site.Lists

foreach ($list in $configurationXml.Site.Lists.List){
 AppendLog "Clearing data for $($list.Name) at site $weburl" Yellow
 if($list.Type -eq "Document Library"){
 deleteItemsFromDocumentLibrary -Url $weburl -ListName $list.Name
 deleteItemsFromList -Url $weburl -ListName $list.Name
 AppendLog "Data in $($list.Name) at $weburl is cleared" Green

How to write PowerShell code part 1
How to write PowerShell code part 2
How to write PowerShell code part 3
How to write PowerShell code part 4

Truly understand the threshold for document set in document library in SharePoint

January 27, 2013 Leave a comment

Recently, I am working on an issue with threshold. The problem is that when the user navigates to a view of the document library, it displays the error message “list view threshold is exceeded”. However, in the view, it has no data. The list view threshold limit is 5000 by default for the non-admin user. This limit is not the number of items returned by your query; it is the total number of items the database needs to read to calculate the returned result set. So although the view does not return any result but to calculate the result (no data to show), it needs to access more than 5000 items in the database. To fix the issue, you need to create an index for the column that you use in the filter for the view. Let’s look at the problem in details. You can download a solution to replicate this issue here.

1. Go to Central Admin ==> Web Application Management ==>General Settings==> Click on Resource Throttling

2. Change the list view threshold in web application from 5000 to 2000 so that I can show the problem without loading more than 5000 items into the list.



3. Go to the page that displays the approved view of the Loan application document set. It displays the message as shown below although I do not have any data returned for this view.

4. To get around this, you need to create an index column. Go to list settings and click on the Index columns.


5. Click on the “Create a new index” link.


6. Select the LoanStatus field as I use this filed as the filter to create the view.


7. After the index is created now I can access the approved view, as you can see it does not return any data.



List View Threshold: Specify the maximum number of items that a database operation can involve at one time. Operations that exceed this limit are prohibited.


SharePoint lists V: Techniques for managing large lists

Manage large SharePoint lists for better performance

How to create a link to Nintex Start Workflow Page in the document set home page

January 19, 2013 3 comments

In this blog post, I’d like to show you how to create a link to start Nintex Workflow Page in the document set home page.

1. Firstly, you need to upload the latest version of jQuery to the style library of your team site.

2. Then, upload a text file to the style library for writing your own html and JavaScript

3. In the document set home page, insert a new content editor web part and link the text file you just upload.

4. Update the text file with the following content, you can download this file here.

<script type="text/javascript" src="/Style%20Library/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="/_layouts/sp.js"></script>
<script type="text/javascript">
$(document).ready(function() {
function buildWorkflowLink(webRelativeUrl,listId,itemId) 
	var workflowLink =webRelativeUrl+"_layouts/NintexWorkflow/StartWorkflow.aspx?list="+listId+"&ID="+itemId+"&WorkflowName=Start Approval";
	return workflowLink;
function getParameterByName(name)
	name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
	var regexS = "[\\?&]" + name + "=([^&#]*)";
	var regex = new RegExp(regexS);
	var results = regex.exec(;
	if(results == null){
		return "";
		return decodeURIComponent(results[1].replace(/\+/g, " "));

function setTheWorkflowLink(listName) 
	var SPContext = new SP.ClientContext.get_current(); 
	web = SPContext.get_web(); 
	list = web.get_lists().getByTitle(listName); 
	SPContext.load(list, 'Title', 'Id');	
	SPContext.executeQueryAsync(setTheWorkflowLink_Success, setTheWorkflowLink_Fail); 
function setTheWorkflowLink_Success(sender, args) 
	var listId = list.get_id(); 
	var listTitle = list.get_title(); 
	var webRelativeUrl = web.get_serverRelativeUrl();
	var startWorkflowLink=buildWorkflowLink(webRelativeUrl,listId,listItemId)
function setTheWorkflowLink_Fail(sender, args) 
	alert("There is a problem setting up the submit exam approval link");
<a href="" target="_blank" id="submitLink"><span style="font-size:14pt">Start the approval process.</span></a> 

5. Save your changes and go to the document set Item, you will see the link is on the home page now.


1. You can create a link to start the workflow using the following build dynamic string configuration:

With this link you will still need to click the start button, this is standard SharePoint behaviour and cannot be altered.


How to use html and JavaScript in Content Editor web part in SharePoint2010

How to use the client object model with SharePoint2010

January 17, 2013 Leave a comment

In SharePoint2010, you can use client object model to communicate with SharePoint server. Today, I’d like to show you how to achieve this by using the c# console application. You can download the solution here.

1. Create a Console application in visual studio and add the following references to the project.

2. Insert your code as below

            ClientContext context = new ClientContext("http://demo2010a");
            Web currentWeb = context.Web;
            context.Load(currentWeb, web =&gt; web.Title);

3. Run your code then you will get the web title displayed as shown below


If you got the following errors, you need to change your target framework from .Net Framework 4 client profile to .Net Framework 4 as shown below:

Change from