Archiwum kategorii: SharePoint 2013

SharePoint 2013 Search CSOM default row limit

Could be an interesting hint for those using CSOM search API: why are some of the results not returned?

Is it trim duplicates setting? No.
Is it some wildcard settings of the result source? No.

If you do not set the row limit of the query, you will get by default only 50 items. However, you can increase it like that:

var query = new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(searchContext);

Last line does the trick. Please note that – by default – 500 is the maximum value.

If you need to increase it, you can do it e.g. via Powershell for the entire search service application:

PS> $mySearchServiceApp = Get-SPEnterpriseSearchServiceApplication
PS> $mySearchServiceApp.MaxRowLimit = 2000
PS> $mySearchServiceApp.Update()
PS> iisreset

Hope it helps,

SharePoint 2013 Content Editor – zero width space characters

Sometimes, the content editor web part of SharePoint 2013 adds unwanted characters to the text within it. You check once, twice, remove any unnecessary line breaks, spaces etc., but after saving or in the HTML source of the page you find these weird characters: ​ – the zero width spaces (& #8203;)

They can mess up your CSS layout, and frankly, I have not found a solution to force SharePoint not to insert them.

One possible workaround would be to remove them with a library like jQuery, e.g.


$(‚.ms-rtestate-field’).each(function(index,element)  {
var theeditor = $(element);

The selector applies to the content editor webpart of SP2013.

Hope this helps.

SharePoint 2013: Get item order ID in the search results display template

In SharePoint 2013, when creating a custom display template for an item, sometimes you need to know, which item in the whole search results list it is. In other words, you need the information of which item in the whole sequence that is, and perform your own logic according to the parameter.

I’ve looked for the property quite a while, but finally found it. It is called piSearchResultId.

Practically you can call it like that in your display template:


It’s value is similar to the following:

0_1 for first item in the list
1_1 for the second item
2_1 for the third item
…and so forth.

With such values you can extract the first number, and there you go!

Hope this helps,

Failed to query the OAuth S2S metadata endpoint

Upon registration of workflow service in SharePoint 2013, running the following command in SP Management Shell:
[powershell]Register-SPWorkflowService -SPSite http://testsite/sites/workflow1 -WorkflowHostUri https://testsite:12290[/powershell]
the following error is displayed:

Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint at URI http://testsite/sites/workflow1/_layouts/15/metadata/json/1 .

Error details: ‚The metadata endpoint responded with an error. HTTP status code: Forbidden.

It seems that the permissions are missing (403). However, if you open the indicated JSON URL with IE logged in as admin, you get the expected result.

In order to resolve this issue:
1. go to Central Administration
2. Manage Service Applications
3. Select the Workflow Service Application
4. In the ribbon bar, click on „Administators”, add tha Farm Admin and grant him full control.

Re-run the shell command, it should now run smoothly without error.

Hope this helps,