Jean Paul's Blog

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

    Advertisements
  • 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
  • Advertisements

Posts Tagged ‘example’

OData and Numeric Comparison Filters

Posted by 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.

clip_image002

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.

clip_image004

clip_image006

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.

clip_image008

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.

clip_image010

Similarly you can play with the remaining Arithmetic operators.

References

https://msdn.microsoft.com/en-us/library/gg309461.aspx

Summary

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

Advertisements

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

Resource Request – Content Type Example

Posted by 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.

Creation

Following is the list.

image

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

image

Now go to Site Settings > Site content types

image

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

image

Following is the Virtual Machine content type inheriting from Computer.

image

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

image

Associate Content Types

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

image

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.

image

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.

image

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.

References
http://technet.microsoft.com/en-us/library/cc262735%28v=office.15%29.aspx

Summary

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 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.

· https://futurecapsblog.wordpress.com/

image

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

Steps

Following are the steps involved.

Step 1: Create Content Source

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

image

Create a New Content Source and Enter the following information.

image

Click OK to save changes.

Step 2: Crawl

Now choose the Full Crawl option for the content source.

image

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

image

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.

image

You will get the following page.

image

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.

image

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

Challenges

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 > http://bit.ly/1k1sIKt

Solution 2: If source in same system, loop back check > http://support.microsoft.com/kb/896861/en-us

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 > http://bit.ly/PomtFg

Solution 2: If source is SharePoint site or library > http://bit.ly/1i99dBs

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

References

http://technet.microsoft.com/en-us/library/jj219808(v=office.15).aspx

Summary

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 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.

Practical

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.

image

Step 1: Create Enterprise Search Center

Create a new site from the Enterprise Search Center template.

image

The Search site will look like below:

image

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:

image

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.

image

image

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.

image

Step 5: Create Refiner

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

You will get the following page.

image

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:

image

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.

image

Click OK button to save changes.

image

Search Refiners are Managed Properties marked as Refinable.

Step 6: Full Crawl

Open Content Sources and Perform another Full Crawl.

image

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.

image

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

image

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

image

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

image

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.

image

This confirms that the Refiners are configured correctly.

image

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.

image

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

References

http://technet.microsoft.com/en-us/library/jj679902(v=office.15).aspx

Summary

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 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:

image

Central Administration > Search Service Application > Result Sources:

image

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.

image

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.

image

Creating a Result Source

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

image

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

Following are the steps summary.

image

Step 1: Create new Result Source

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

image

Choose the New Result Source link.

Step 2: Modify Query

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

image

Then Launch the Query Builder and enter the following code.

IsDocument:True

image

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

image

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.

image

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

http://www.microsoft.com/en-us/download/details.aspx?id=35491

Navigate to All Files > Pages library as shown below.

image

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

image

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:

http://server/esearch/Pages/documentresults.aspx

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

image

image

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.

image

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.

image

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

image

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.

image

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.

image

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.

References

http://technet.microsoft.com/en-us/library/jj683115(v=office.15).aspx

http://technet.microsoft.com/en-us/library/jj219620(v=office.15).aspx#Query_vars_temp

Summary

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 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.

image

Step 2: Create Page

Add a new page and choose  the Edit Page option.

image

Enter the page name as SlidePage.

image

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.

image

Add the web part to the page.

Step 4: Configure Web Part

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

image

In the appearing dialog box choose the following options.

image

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.

image

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.

image

The slides will start changing after few seconds.

Note

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.

Summary

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 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.

clip_image002

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.

clip_image003

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

clip_image005

You will get the following screen.

clip_image007

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.

clip_image009

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.

clip_image010

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.

clip_image011

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

clip_image012

Step 4: Stop Recording

You can delete all the URLs except one.

clip_image013

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.

clip_image015

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

clip_image017

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

clip_image018

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

clip_image020

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.

clip_image022

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

clip_image024

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

clip_image020[1]

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

References

http://msdn.microsoft.com/en-us/library/jj710162.aspx

Summary

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 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.

image

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

Solution

We can use Page Viewer web part.

Create a new page.

image

Choose Edit Page & Insert Page Viewer web part.

image

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

image 

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

image

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.

Solution

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 = {
            url:”http://hp/_layouts/Upload.aspx?List={E4C76E09-2F22-4C18-A20E-C07E56F246D9}&RootFolder=%2FShared%20Documents%2FHuman%20Resources”,
            width: document.body.offsetWidth,
            height: document.body.offsetHeight,
            dialogReturnValueCallback: DialogCallback
            };

        SP.UI.ModalDialog.showModalDialog(options);
}

function DialogCallback(dialogResult, returnValue)

  location.reload();            
}

You can find the HTML Code window here.

image

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.

image

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.

image

Summary

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.

References

How to use Content Editor web part?

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

Understanding 2 Stage Recycle Bin

Posted by 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.

image

Step 2: Create List

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

image

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.

image

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

image

You will get the following confirmation prompt.

image

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.

Quota

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

Summary

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 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.

clip_image002

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

clip_image004

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.

clip_image005

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

clip_image007

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

clip_image009

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.

clip_image010

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

clip_image012

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

clip_image013

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

clip_image015

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.

clip_image017

This concludes our usage with Document Set.

clip_image019

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

References

http://technet.microsoft.com/en-us/library/ff603637.aspx

Summary

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 »