Navigation Bar

Monday, 12 May 2014

Customising SharePoint 2013 People Search Result


Customising SharePoint 2013 People Search Result

1.       Copy an existing Display Template for People residing at Master page and page layouts gallery under Display Templates\Search\Item_People.html

2.       Name it whatever you want. For instance Item_KI_People.html

3.       To check the exact name of the field you are adding to ManagedPropertyMapping, go to your Search Service Application and click on Search Schema and view the property name of your desired property as shown below:

 







4.       Edit Item_KI_People.html file in your notepad and add following highlighted/boxed text:


 
 
 





5.       Upload as Item_KI_People.html and provide value for the metadata as shown below image:

 
 


6.       Navigate to Site Settings > Result Types

7.       Click on existing Person result type and select Copy

8.       Provide values as shown in image:
 
 

9.       Click Save.

10.   Now go to http://kispapp-dev:8080/Search/Pages/peopleresults.aspx?k=masood and replace kispapp-dev:8080 with your site hosting search center.

11.   Edit peopleresults.aspx page

12.   Edit People Search Core Results web part and select your desired Item Display Template shown in below image:
 



13.   Click OK and perform search and you would see new changes as shown below:



14.   That’s it. Enjoy and comment if it helped you save your time.

Wednesday, 5 March 2014

Managing Permissions of Service Applications through PowerShell

Recently I was configuring PerformancePoint for a client. I did it through Central Admin but I wanted it to script so that their administrator can easily create in other environment.

There a lot of posts available about how to create Service Application and add administrators through PowerShell but could not find any post that describe add users to “Permissions” section of Service Application. I have highlighted the section in below image.



In this post I will share some PowerShell script that I used to assign permissions for Service Application (i.e. PerformancePoint Service Application) but can be used for other type of Service App.

#Define couple of variables
$ServiceAppName = "PerformancePoint Service Application"
$ServiceAppAdminAccount = "domain\youradmin"
$ServiceAppPoolAccount = "domain\yourapppool"

#Getting Service Application instance
$ServiceApp = Get-SPServiceApplication | where{$_.Name -eq $ServiceAppName }

Write-Host "Adding Administrators..." -ForegroundColor Yellow

$principal = New-SPClaimsPrincipal $ServiceAppAdminAccount -IdentityType WindowsSamAccountName

$security = Get-SPServiceApplicationSecurity $ServiceApp –Admin
Grant-SPObjectSecurity $security $principal "Full Control"

Set-SPServiceApplicationSecurity -Identity $ServiceApp.Id -ObjectSecurity $security –Admin

Write-Host "Users '$ServiceAppAdminAccount' have been addd to 'Administrators' group of Service App" -ForegroundColor Green

Write-Host "Adding Service Account to Permissions group of Service App..." -ForegroundColor Yellow

$principal = New-SPClaimsPrincipal $ServiceAppPoolAccount -IdentityType WindowsSamAccountName

$security = Get-SPServiceApplicationSecurity $ServiceApp
Grant-SPObjectSecurity $security $principal "Full Control"

Set-SPServiceApplicationSecurity -Identity $ServiceApp.Id -ObjectSecurity $security

Write-Host "Users '$ServiceAppPoolAccount' have been addd to 'Permissions' group of Service App" -ForegroundColor Green

That's it.

Thursday, 20 February 2014

Got my SharePoint 2013 App called "Sliding Boxes" published


Today I got another app for SharePoint 2013 called “Sliding Boxes” published to Office store. It is a puzzle game and built using HTML 5 Canvas, jQuery and KnockoutJs framework.





Download it, play and enjoy J

Stay connected I will blog and share some code snippet  with you.

Monday, 10 February 2014

Error in the Microsoft Server People Protocol Handler

Recently I was configuring People search and I was having some issue with crawling. I spent lot of time for searching and recreating the UPA but was not able to crawl.

If you have configured Synchronization connection and able to synchronised people from Active Directory to your SharePoint environment but you are getting “Error in the Microsoft Server People Protocol Handler” then this blog may help to fix the issue.

The first thing you need to make sure that the default content access account should have access to User Profile Service Application to fetch people data.

To check which account is configured for crawling, go to Search Service Application and check what is the account mentioned in “Default content access account” as shown below:


Next go to Service Applications and select “User Profile Application” and click “Administrators” and check your crawler (for demo: domain\crawler) should have access to “Retrieve People Data for Search Crawlers” as shown below:

 
 
Now start crawling (perform full crawl) and check whether you still getting same error. If yes then check another permission mentioned in next paragraph.

Next click on “Permissions” for selected User Profile Application and check whether your crawler have access to invoke service application.   


Now start crawling (perform full crawl) and check whether you still getting same error. If yes then check another permission mentioned in next paragraph.
The last check you should do is to verify your My Site Host web-app is associated with User Profile Service Application.
Go to Application Management > Configure service application associations

Check your My Site Host web-application proxy group and click the to make sure your User Profile Service Application is associated if not then add “User Profile Service Application” to that proxy group.

Now start crawling and you would not get that error.

Hope this post help you save time and fixed your issue. Let me know if you still having issue with crawling for people data.

Friday, 31 January 2014

Feature is NOT visible in SharePoint 2013 - newly migrated from SharePoint 2010

One of the client they migrated their intranet from SharePoint 2010 to SharePoint 2013. So I develop couple of new features (SharePoint Feature) and deployed to new environment but it was not listing in Site Collection and Web level features sections.

So after doing some investigation what I found that the version of their portal was 14 (which SharePoint 2010 version).  So to make your Features available in Site Collection or Web level features list, you have to modify your SharePoint Product version as shown below:

Expand your package as shown in below image:

 


Double click on the Package.package item highlighted above and open properties window as shown below:












 

 
 
 
 
 
 
 
 
 
 
 
Change the version to 14.0 for SharePoint Product Version and deploy your solution and install feature using below PowerShell command:

Install-SPFeature <FeautreName> -CompatibilityLevel 14 –force

Where <FeatureName> should be replaced with Feature directory name or Feature Guid you have.

Hope that helps.

Wednesday, 20 November 2013

Developing and deploying SSRS Reports to Pre-Prod/Production environment

Recently I was developing an application for a client that requires SSRS report to view the status. I built the application in SharePoint, .NET (Entity Framework) and SSRS reports. I am not going into the details of the application but I will post about the SSRS reports.

The report is accepting a parameter from query string to load the data but by doing this, we were allowing anyone to see other’s data that we don’t want. To make your report secure you have to add a field saying “Created By” so that report can only show the currently logged-in user report.
I am creating a demo project for this purpose to show the steps you can follow.
Create a project




Add a Shared Data Source and supply your database connection information
Add a report item and write your query to show the data.
Now add “Parameter” called it “CurrentUser” as shown below





In the Default Values section, select “Specify values” and then click “Add” button as shown below:






Click OK.

Add another parameter called “RecordId” to filter record.



Now go back to your Dataset and edit it and update your query to include “CurrentUser” and “ReocrdId” parameter as shown below



Now supply 1 or whatever Id you have got in your database associated with currently logged in user to view data. Below is a sample screenshot:



but as soon as I supply any other record id which is not associate/related to currently logged in user, it just shows blank report. That how I want my report to work.

Deploying report to PRE-PROD/PRODUCTION environment

To deploy a reports in SharePoint integrated environment, you need to follow below steps:

Create a Report Library that will keep your reports and call it “Reports” or whatever you want. Or if you have that library you can use it.


Create a data connection library that will keep your database connection for the reports and call it “Demo DataConnections”



Create a .rsds file in your favourite notepad and name id “Dem-DataConnection.rsds” or whatever you want to call it and write below contents:

<?xml version="1.0" encoding="utf-8"?>
<DataSourceDefinition xmlns="http://schemas.microsoft.com/sqlserver/reporting/2006/03/reportdatasource">
  <Extension>SQL</Extension>
  <ConnectString></ConnectString>
  <CredentialRetrieval>Integrated</CredentialRetrieval>
  <Enabled>True</Enabled>
</DataSourceDefinition>
Create a data connection item in above created library (i.e. Demo DataConnections”) by uploading .rsds file and save it. Once it is uploaded, go back to your data connection library and click on link appears in the Name field as shown below:


After clicking on “Demo-DataConnection” link shown in Name field, you will be given another screen to supply connection to your desired database:

Now upload your reports (.rdl files) in “Demo Reports” library.
Now go back to your reports library and select your uploaded report, expand ECB menu and then click on “Manage Data Sources” as shown below:







You will be shown a page, where you can associate Data Source for your reports, like below:

Click on “ReportDataSource” link and associate your data connection to this report so that report can talk to database and fetch records.



Click OK, OK and Close and you are done.
Now click on your report to view the data. So far the report is configured but it will not take any parameter from query string to pass to your report.

Creating Report page that accept values from Query string

To create a report page that can accept values from query string and can pass to your report and can be linked with application please follow below steps:
Create a page in Pages library or Site Pages
Add SQL Server Reporting Services Report Viewer web-part and click on “Edit web part Properties” as shown below:



and select your report.
Now add “Query String (URL) Filter” web-part and give a parameter name that you will be passing in URL. For instance http://www.mmasood.com/Pages/Report.aspx?ReportId=1

Connect Query String Filter web-part to SQL Reporting Service Report web-part and bind the parameter to your report like shown below

Once it is connected, you can supply value in query string (i.e. http://www.mmasood.com/Pages/Report.aspx?ReportId=1 ) and that will be passed to your report.
I will try to package it in wsp and will upload it soon. That’s all.

Thursday, 12 September 2013

Creating Master page and Page Layouts in SharePoint 2013

In this post I am going to share how to create Master page and page layouts in SharePoint 2013 using html file you have.
 
When I create Master page and page layout, I use common .css for all pages, that I include in Master page and for each page layout I create separate .css file so that I can manage page layout easily.

1.       Open Design Manager
2.       Click on Edit Master Pages

There are two options, you can either create using an .html file (i.e Converting .html file to SharePoint Master page) or you can start with startermaster page

I have used below .html file (shown as image) to create my master page:






Click on “Convert an HTML file to SharePoint master page” and click add link to upload your or above .html file and then click Insert button as shown below:


Once you have created, it will be displayed in the list of master pages. Click on the master page you just created, it will show something like shown below:



Now go to Master page and Page layouts gallery, and download the generated .html and save it. Come back to “Master Page preview” and click on Snippets.

I am going to add “Search box” from the snippet to the .html master page. Click on “Search box” control, it will show below screen:



Click on “Copy to Clipboard” button, to copy the html of the control to clipboard. Now open the generated .html master page and paste the above copied html source to appropriate location.

Repeat the same process for Top navigation.

Here is the page created using above created master page:



Now I am going to share, how I usually create Page Layout in SharePoint 2013.

1.       Go to Design Manager
2.       Click on “Edit Page Layouts”
3.       Click Create a page layout

For this demo purpose, I am creating a welcome page layout with two columns and one column layout.

When you click “Create a page layout”, it asks you to provide name, master page and content type, I have provide below details:



Once, page layout gets created, go to Master page and page layouts gallery and download .html file of above page layout.

Remove contents between <!--MS:<asp:ContentPlaceHolder ID="PlaceHolderMain" runat="server">--> and <!--ME:</asp:ContentPlaceHolder>-->

And add below line to associate its own .css file

<!-- custom css -->

<link type="text/css" rel="stylesheet" href="/_layouts/15/Jacobs/DemoPortal/Css/Custom_Minimal/Custom_Welcome.css"
ms-design-css-conversion="no" />

Don’t forget to include “ms-design-css-conversion=no” attribute. Go back to Design Manager, and click on “Edit Page Layouts” and then click on newly created page layouts like shown below:



Now click on Snippet to add some web-part zones in it. When you add web-part zone in snippet area, it shows property of that web-part zone. The web-part zone has got a property called “Header Text” that shows the title of the zone.

Below is an image of a page in edit mode created using above page layout:



And finally here is the output page with web-parts:

 
 

That’s it.