Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand

Posts Tagged ‘example’

OData and Numeric Comparison Filters

Posted by Jean Paul on June 21, 2015

In this article we can explore OData using Numeric Comparison filters.

Numeric Comparison Filters

Following are the Numeric Comparison filters available with OData

lt Less Than
le Less Than or Equals To
gt Greater Than
ge Greater Than or Equals To
eq Equal To
ne Not Equal To

Data Preparation

To proceed with the example I encourage you to create a Contacts list with a column named Age of type integer. Please fill some data appropriately.


eq Filter

Following is the example of using Equal filter where the column Age is equal to 30.

http://server/_api/Web/Lists/GetByTitle(‘Contacts’)/Items?$filter=Age eq 30

The result was one list item as per my data.



Please note that uppercase (EQ) won’t work.

ne Filter

Following is the example of using Not Equal filter where the column Age is not equal to 30.

http://server/_api/Web/Lists/GetByTitle(‘Contacts’)/Items?$filter=Age ne 30

Obviously it returned a lot of items.


lt Filter

Following is the example of using Less Than filter.

http://server/_api/Web/Lists/GetByTitle(‘Contacts’)/Items?$filter=Age lt 10

As there are no items with Age less than 10, my result was empty.


Similarly you can play with the remaining Arithmetic operators.



In this article we have explored Numeric Comparison filters of OData on SharePoint 2013 REST services.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , , | Leave a Comment »

Resource Request – Content Type Example

Posted by Jean Paul on November 30, 2014

In this article I would like to share a real-life scenario of using content types.

Resource Request

You are working as an IT Support Person.  The company employees need to raise various resource requests like:

  • Computer
  • Virtual Machine
  • Tablet

You need to also capture the configuration information from them, like:

  • Computer – CPU Cores, RAM, HDD Size, HDD Type, Users, Admin Users etc.
  • Virtual Machine – Domain, All Computer parameters
  • Tablet – Model, Storage etc.

Additionally, all these should be tracked along with following fields:

  • Status – Open, In Progress, Closed
  • Requester
  • Resolver
  • Created Date
  • Resolved Date

Content Type

The above scenario is good for content type.  We can also apply content type inheritance here.


Following is the list.


Now go to the list > List Settings > Advanced Settings > Allow management of content types > Enable


Now go to Site Settings > Site content types


Following is the Computer content type inheriting from base content type.


Following is the Virtual Machine content type inheriting from Computer.


Following is the Tablet content type inheriting from base content type.


Associate Content Types

Now go to the List > List Settings > Advanced Settings > Add Content Types


Do not forget to remove the default Item content type from the list.

(Click on Item content type and choose Delete option)

Add New Item

Now try adding a new item to our Resource Request list.


You are ready now to expose the list to employees.  They can generate new resource requests in a much easier way & the IT Support won’t miss any important parameters regarding the resource.


Please note that unlike document libraries, the content type drop-down won’t appear in the new form Or along with the Create link.  You need to do certain JS or CSS customization to enable this.



In this article we have explored how to use content types in a Resource Request scenario.  Adding workflows / alerts would notify the IT Support people immediately.

Posted in SharePoint, SharePoint 2013 | Tagged: , , | Leave a Comment »

Search Content Source to Website

Posted by Jean Paul on May 1, 2014

In this article we can create a Search Content Source to a Website.

What is the Goal?

Our goal is to make the content in following blog searchable from SharePoint 2013.



Please note that above is a Reference web site. You can come up with your own web site with valid robots.txt file.


Following are the steps involved.

Step 1: Create Content Source

Open Central Administration > Service Applications > Search Service Application > Content Sources


Create a New Content Source and Enter the following information.


Click OK to save changes.

Step 2: Crawl

Now choose the Full Crawl option for the content source.


Wait for a few minutes for the crawling to be completed.


SharePoint will be accessing the Home Page through the URL, parsing contents, reading metadata, extracting URLs and digging deeper for more contents & all together forms the indexing.

Step 3: View Log

You can check the Content Source for any Crawl Errors or Warnings that prevent from showing content.


You will get the following page.


You can click on the links to view the error/warning. Discard the non-serious ones.

Step 4: Search

Open the Enterprise Search Center site & type the following text.


You can see the results showing with above blog url. This confirms our Web Content Source configuration.


In the real world scenarios things won’t work in this speed. You may encounter the following issues & I can provide some links to resolve them.

You can view these errors from the Content Source > View Crawl Log menu.

Item not crawled due to one of the following reasons: Preventive crawl rule; Specified content source hops/depth exceeded; URL has query string parameter; Required protocol handler not found; Preventive robots directive

Solution 1: If query strings involved in URL go for Crawl Rules >

Solution 2: If source in same system, loop back check >

The content for this address was excluded by the crawler because this item was marked with a no-index meta-tag. To index this item, remove the meta-tag and recrawl.

Solution 1: If source is external web site check for robots.txt >

Solution 2: If source is SharePoint site or library >

As a common measure I would recommend applying SharePoint Cumulative Updates & Operating System Service Packs to the machines.



In this article we have explored how to create a Web Content Source in SharePoint 2013.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , , , , | Leave a Comment »

Search Refiners

Posted by Jean Paul on April 20, 2014

In this article we can explore another important feature called Search Refiners & Faceted Navigation

What is Search Refiner?

Refiner is a Managed Property based on Search Index. We can use Search Refiners to narrow down search results. Following is an example of Search Refiners.

Through advanced configuration & Scripting, we can modify the Visual Refiners as well.

What is Faceted Navigation?

Faceted means Smooth. Faceted navigation is the process of browsing for content by filtering on refiners that are tied to category pages.


In the practical let us try out using a Search Refiner. We are trying to create a Refiner of type text to filter out different states like California, New York, Florida etc.


Step 1: Create Enterprise Search Center

Create a new site from the Enterprise Search Center template.


The Search site will look like below:


Step 2: Create List & Data

Create a List in your main site with the following fields & name it as Vendors:

1. Title, string

2. ServiceLocation, choice with values [California, New York, Florida]

Enter 3 items with common values for the Title column but different ServiceLocation as shown below:


Step 3: Start Full Crawl

Go to Central Administration > Service Applications > Search Service Applications > Content Sources.

Choose the Local SharePoint Sites content source & Initiate a Full Crawl.



Stop existing Crawls if there are any Continuous or Incremental Crawl running. If you are using Incremental Crawls, things may not work as expected, please do a Full Crawl.

Wait for few minutes for the Crawl to get completed.

Step 4: Test Search

Now go the Enterprise Search Center site and do a Test Search for SSD. You should be seeing multiple results as shown below. This ensures that the Crawling went fine.


Step 5: Create Refiner

Go to Central Administration > Service Applications > Search Service Applications > Search Schema

You will get the following page.


Choose the New Managed Property link. We are going to create a new Managed Property. Enter the values for the properties:

1. Name

2. Searchable

3. Queryable

4. Retreivable

5. Refinable

As shown below:


Scroll down & choose the Add Mapping button. Search for the text ServiceLocation and you should get the Crawled Property as shown below. Select the property & choose the Add button.


Click OK button to save changes.


Search Refiners are Managed Properties marked as Refinable.

Step 6: Full Crawl

Open Content Sources and Perform another Full Crawl.


Wait for the Crawl to get completed.

Step 7: Add Refiner to Results page

Open your Enterprise Search Center site and go to the Results page.


Choose the Edit Page option & Edit the Refinement web part & Click on the Choose Refiners button.


In the appearing dialog box select the ServiceLocationManagedProperty and Add to the Refiners list. Enter a Display Name as well.


Click the OK button to close the dialog. Click the OK button for web part as well.


Save changes to the page.

Step 7: Test the Page

Now try searching for the text SSD and you will see the results and refiners.


This confirms that the Refiners are configured correctly.


Please note that the Refiner Strings appears based on the results. If the result does not have New York, then the refiner string won’t appear.


If you are using Site Columns you will get the Managed Property automatically created.



In this article we have explored Search Refiners. I believe this will be useful in real world scenarios. In advanced configurations, you can create your own Visual Refiners as well.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , | 1 Comment »

Search – Result Sources

Posted by Jean Paul on April 18, 2014

In this article we can explore the Result Sources in SharePoint 2013 Search.

What is Result Source?

Result Source (Vertical) is a sub set or particular type of content. They are used to limit search results.

For example, we can use Result Source for a particular:

1. Content Type

2. Sub Site

Default Result Sources

SharePoint 2013 has 16 pre-configured result sources. The default one is Local SharePoint Results:


Central Administration > Search Service Application > Result Sources:


What is inside the Result Source?

We can closely examine a Result Source. Click on the Local Video Results result source. You will be taken to the page where it shows a Query Transform which controls the results.


The Query Transform text is below:

{searchTerms?} {?path:{Scope}} {?owstaxIdMetadataAllTagsInfo:{Tag}} (ContentTypeId:0x0120D520A808* OR (SecondaryFileExtension=wmv OR SecondaryFileExtension=avi OR SecondaryFileExtension=mpg OR SecondaryFileExtension=asf OR SecondaryFileExtension=mp4 OR SecondaryFileExtension=ogg OR SecondaryFileExtension=ogv OR SecondaryFileExtension=webm))

The searchTerms parameter represents the user-query-terms. The remaining text checks for Content Type Id and File Extensions. We can also create custom query transforms.

For more information on Query Transform you can check References section.

Each Result Source can be connected to the Search Navigation web part.


Creating a Result Source

Now we can try creating a new Result Source & Connecting it to the Navigation web part.


Our target is to create a Documents result source & connect to the navigation web part.

Following are the steps summary.


Step 1: Create new Result Source

Open Central Administration > Manage Service Applications > Search Service Application > Result Sources link


Choose the New Result Source link.

Step 2: Modify Query

In the appearing page, enter the name for the Result Source as Docs.


Then Launch the Query Builder and enter the following code.



You can also test the query using Test Query button. Once you are seeing results you are good.


We are using the KQL (Keyword Query Language) syntax to filter the result. The term {searchTerms} will be the user input keywords. Please make sure you have enough documents satisfying the result.

Step 3: Create Page

Each Result Source should be connected with a Result Page. To create a new page, open SharePoint Designer 2013 and navigate to your Enterprise Search Center site.


If you do not have SharePoint Designer 2013 installed, you can download it from:

Navigate to All Files > Pages library as shown below.


Copy & Paste the results.aspx and rename the new file as documentresults.aspx.


Close the Designer.

Step 4: Modify Page

We need to modify the new result page & choose our new result source. Inside SharePoint navigate to the new documentresults.aspx. In my case the URL was:


Choose the Edit Page option & bring the Search Results Web Part in edit mode.



Each Result Page will be having pre-configured web parts like:

1. Result web part

2. Refiner web part

3. Navigation web part

Choose the Change Query button & Select our new Result Source as shown below.


Click OK to close the web part editing & Save changes to the page.

We are now ready with the following:

· Result Source

· Result Page

We need to create the Navigation Link next.

Step 5: Create Navigation Link

From the Enterprise Search Center choose Site Settings. Then choose Search Settings link.


In the appearing page scroll down to the Configure Search Navigation.


Choose an existing link & Click the Edit button to understand the properties. Then click on the Add Link to create our new navigation link. Enter the Name and Navigation Link appropriately.


Please note that the Navigation Link is relative to the site.

Save changes to the dialog & Click Ok to save the navigation items.

Step 6: Testing the link

Type your new search keyword & click on the newly appeared Docs link.


You can see that the Results are filtered to show only document items. You can also see the Result URL has changed to http://hpvm/esearch/Pages/documentresults.aspx

This confirms our Result Source creation & testing.



In this article we have explored Result Sources in SharePoint 2013 Search with an example. In advanced scenarios, I recommend you to refer the KQL (Keyword Query Language) and FQL (FAST Query Language) to create complex search verticals.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , , | Leave a Comment »

Slide Show using Content Search Web Part

Posted by Jean Paul on March 5, 2014

In this article we can explore how to use a Content Search Web Part to create a Slide Show of images.

Step 1: Create Picture Library

Create a document library of type picture library, change the name to Slides and add some pictures into it.


Step 2: Create Page

Add a new page and choose  the Edit Page option.


Enter the page name as SlidePage.


Step 3: Insert Content Search Web Part

Choose the Insert tab & Web Part ribbon item; Choose the Content Rollup category and then the Content Search web part.


Add the web part to the page.

Step 4: Configure Web Part

Choose the Edit Web Part option & click the Change query button.


In the appearing dialog box choose the following options.


You are specifying:

  1. Pictures to be displayed
  2. Scoping to a URL
  3. Specifying our picture library URL

From the right pane you can verify the results.

(It takes 15 minutes for the search crawl to refresh new contents)

Save the dialog.

From the web part properties make the following changes in Display Templates section.


Click OK to save the web part. Save changes to the page.

Step 5: Test the web part

Refresh the slide page & you should be seeing the following display.


The slides will start changing after few seconds.


There can be a 15 minute delay for the Search Crawl to update the new picture documents.  Please ensure you refresh the page after 15 minutes of upload.


In this article we have explored how to use Content Search Web Part for doing a Slide Show.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , , , , | Leave a Comment »

Load Testing SharePoint 2013 Site

Posted by Jean Paul on March 4, 2014

In this article we can explore the offering of Visual Studio 2012 Ultimate for Load Testing a SharePoint 2013 site.

What is Load Testing?

Load testing is the process of putting demand on a system or device and measuring its response. 

For example, we can test a SharePoint Site by simulating a load of 100 users at the same time. We can measure the response, possible-errors to validate the load-capacity of the servers(s) and measure Performance, Scalability, Endurance and Volume.


Who Performs Load Testing?

Often load testing is performed by Automation Testers on a pre-configured test environment with same-topology of the production system.

What is the Configuration needed?

Often load testing is performed by Automation Testers on a pre-configured test environment with same-topology of the production system.

What we can infer from the results?

We can use the results for Capacity Validation for coming up with better Capacity Planning.

For example, if the expected response time is 3 seconds for 500 users / minute scenario, and the test result is showing 5 seconds, surely we need to optimize server (s) or change topology based on the bottle necks.

Load Testing helps us validating & improving performance yielding maximum-productivity from the system.

What is the version of Visual Studio 2012 required for Load Testing?

Visual Studio 2012 Ultimate is required for doing Load Testing.


You can get a trial download from here.

Simple Load Testing

To perform a simple load testing, please follow the steps below:

Step 1: Create new project

Create a new project of type Web Performance and Load Test Project


You will get the following screen.


Step 2: Start Recording

Recording is the process of teaching Visual Studio about our activity. The browser will be launched & the URL entry, mouse clicks, keyboard entries will be recorded. The recording will be used for play back later.

Click on the Start Recording button as highlighted above. You will get the following browser window.


Type the URL and enter credential information.

Step 3: Stop Recording

You can see the left pane logs all the requests for pages & scripts. Click the Stop button to stop recording. We are just testing a simple home page load scenario.


Visual Studio will try to find the dynamic parameters like text box entries. The dynamic parameters should be replaced with on-the-fly unique values to avoid duplication.


Time being we do not have any dynamic parameters. You should be getting similar results below in Visual Studio.


Step 4: Stop Recording

You can delete all the URLs except one.


Step 5: Add Loop

We are now adding a loop of 10 counts to the above test. Right click on the url node and choose the Add Loop option.


In the appearing dialog box choose Counting Loop and enter property as 10.


Click the OK button to save changes & you will see the new loop item as shown below.


We are going to try a loop of 10 times to ensure proper page response within 3 seconds.


Please note that 3 seconds is one standard-measure of page response time.

Step 6: Play Recording

Choose the Run Test option from the menu.


You can see the test will get executed 10 times & the result will be similar to below.


You can see that the average response time is less than 3 seconds. This concludes our simple test scenario.


The above is a simple test scenario. Once you gain confidence, you can go for higher levels like:

1. Opening list pages, clicking new item, entering data, clicking save, changing dynamic parameters

2. Testing against production-topology simulated environments

3. Testing with simulated user-volume

4. Passing Credentials

5. Using various load-testing options available in Visual Studio



In this article we have explored an overview of Simple Load Testing of SharePoint sites. I hope this will help you gain the grounds for advanced real world scenarios.

Posted in SharePoint, SharePoint 2010, SharePoint 2013 | Tagged: , , | Leave a Comment »

Page Viewer web part to show List folder contents

Posted by Jean Paul on February 17, 2014

In this article, I will show the usage of Page Viewer web part to show List folder contents.

Following is our List with 3 folders.


You need to configure a Page which only shows the contents of Human Resources.  How to achieve it?


We can use Page Viewer web part.

Create a new page.


Choose Edit Page & Insert Page Viewer web part.


Construct the folder path in file-url format.

file://hp/davWWWroot/Shared Documents/Human Resources

Please note that the above url contains davWWWroot for accessing the folder contents & omitted the Lists from the url.

davWWWRoot is a special keyword that alerts the WebDAV client that you are referring to the root of a WebDAV server.

From the web part properties, choose Folder  & Paste the URL.c


Click the Ok button & You should be ready with the Folder View.


Please note that we can connect to any SharePoint or Network folder in this way.

Next Challenge

Now your users will start asking for the Add Document link which is missing.


As a solution we can do the following:

  1. Edit the page
  2. Insert a Content Editor web part, Hide the Chrome
  3. Edit the web part
  4. Edit the HTML
  5. Create a link that calls JavaScript code
  6. Insert the JavaScript code below

<a onclick=”OpenDialog();” href=”#”>Add Document</a>

function OpenDialog(){
        var options = {
            width: document.body.offsetWidth,
            height: document.body.offsetHeight,
            dialogReturnValueCallback: DialogCallback


function DialogCallback(dialogResult, returnValue)


You can find the HTML Code window here.


You need to copy the URL from original list > folder > Add document > Copy shortcut action.

Clicking the Ok button & Saving the changes you can refresh the page to Add Document.


You can see that Folder automatically shows Human Resources value.

Selecting a document & clicking Ok button will take you through the previous page with a  Refresh.



In this article we have explored how to use Page Viewer web part along with the Add Document functionality.  I hope this will be useful in real-worlds scenarios.


How to use Content Editor web part?

Posted in SharePoint, SharePoint 2010 | Tagged: , , , | Leave a Comment »

Understanding 2 Stage Recycle Bin

Posted by Jean Paul on February 10, 2014

In this article I will take you through 2 Stage Recycle Bin through an example.

2 Stage Recycle Bin

SharePoint have a 2 Stage Deletion Process.

When you delete an item, it will go to the Site Recycle Bin.  This is Stage 1.

Once you delete the item from Recycle Bin, it will reach Site Collection Recycle Bin. This is Stage 2.

After 30 days, the item will be automatically deleted from the Stage 2 Recycle Bin.  Once it is deleted, you need Content Database restore or such techniques to get the item back.

Let us analyze this step by step.

Step 1: Create List

For starting with create a list named Test.


Step 2: Create List

After creation, Go to List Settings & Choose Delete option.


Step 3: Open Recycle Bin

Open Recycle Bin from the Quick Launch & You can see the list is there. (First Stage)

image http://hp/_layouts/recyclebin.aspx

Delete the list from there too.


Step 4: Check Site Collection Recycle Bin

Click on the Site Collection Recycle Bin link from the above page & You can see the following page.

(Please check the URL)


image http://hp/_layouts/AdminRecycleBin.aspx

By default it should stay there for 30 days.  Choose the Deleted from end user Recycle Bin option


You will get the following confirmation prompt.


Click the Ok button to confirm deletion & Your list is permanently deleted.

Now the only option remaining to retain it is to use Backup Database.


Please note that the First Stage Recycle Bin affects Site Collection Quota & the Second State does not.


In this article we have explored the 2 Stage Recycle Bin.

Posted in SharePoint, SharePoint 2010, SharePoint 2013 | Tagged: , , , , | Leave a Comment »

Document Set Feature in SharePoint 2013

Posted by Jean Paul on August 8, 2013

In this article I would like to take you through the Document Set feature of SharePoint 2013.

What is Document Set?

Document Sets are a feature in SharePoint Server 2013 that enables an organization to manage a single deliverable, or work product, which can include multiple documents or files.

Simply, you can see it as a collection of documents packed together.

While working with Document Libraries, you can upload Document Set instead of a single Document. A Document Set can contain multiple documents having same columns as the document library.

How to enable Document Set?

For enabling & using Document Set, the steps are given below:

1. Activate Document Set feature

2. Enable Content Type

3. Add documents

Please see the steps below:

Activate Document Set feature

Open your site, then Site Settings page.


Click on the Site collection features link, you will get the page below.


Click on the Activate button corresponding to Document Sets feature. Wait for a while for the activation operation to complete.

Enable Content Type

Document Set is enabled for a library by Enabling Document Set content type.

Create a new library, Choose the library settings, Advanced Settings & enable the following option.


Save changes & go back to the Library Settings. From the content types section, choose the Add option.


In the appearing page, add the Document Set content type & save changes.


Now you are ready with multiple content types for your document library.

Add Documents

Open the document library & choose the FILES tab, select the New Document Set context menu.


In the appearing dialog box, enter the name of the Document Set, you can upload documents later.


Saving changes will take you to the next screen for adding documents.


Here you can add multiple documents for the same document set . Please note that the upload screen says Document Set as “Folder”.


As shown below, you can see that the multiple documents exist in the same document set. Plus, the document library columns are available for the child documents as well.


This concludes our usage with Document Set.


Under the hood, Document Set can be considered as a Folder.



In this article we have explored the Document Set feature of SharePoint 2013, Activating, Enabling & Creating a document set.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , , , | Leave a Comment »