SharePoint birthday and anniversary web part using search results

This blog will show you in detail how you can create a birthday and anniversary web part using a search results web part with a custom Display Template and CSS. This web part uses the user profile birthday property which people can fill in their self. I’ve started testing with display templates and decided to try and create a display template to show upcoming birthdays. You will get the following output when you follow this blog correctly:

image

You can find the display template and css file at the end of this blog.

Start creating your birthday and anniversary web part

Mapping the birthday property to a managed property

The birthday property can be filled in on users profiles but they can’t be used in Search Result web parts out of the box.
Go to the Search Center in the Office 365 SharePoint Admin Center

image

Go to Manage Search Schema -> crawled properties and search for birthday

clip_image001

You can see that it hasn’t been mapped to a managed property.
Click on the property

clip_image001[5]

Add a mapping

clip_image002

Map this property to a RefinableDate which is available and click twice on OK

clip_image003

It can take up to 8 or 16 hours for this property to be available in your site.

Set up search results web part

Go to the site where you want to add the birthday webpart

clip_image001[7]

Add Web Part

clip_image002[5]

Add

clip_image003[5]

Edit Web Part and first change the following settings

clip_image005

clip_image007

And the following appearance

clip_image009

Click on apply and change the search query

There is 1 problem with this query. The full date of a user’s birthday is based on the year 2000. This means that my birthday is 22 december 2000 according to Microsoft. I was unable to create a search query which looks to the next 5 anniversaries based on the current date alone so I used the following command to count the number of days to the year 2000.

new-timespan -start “1/6/2000” -end $(get-date)

which gives me the following result

clip_image011

So my search query will look like “*   RefinableDate00>{Today-5845}”
Note that I added 1 more day so the current date will also be listed!
You will need to change the days every year for the webpart to find the correct birthdays (let me know if you have a better search query 🙂 )

SNAGHTMLd42cd07

Go to the sorting tab

image

Click on OK and Save the web part

Upload display template files

Upload birthday.html

First change all the refinabledate properties in the birthday.html to the property you have specified:

clip_image001[9]

Go to site settings

clip_image002[7]

Go to Master pages

clip_image003[7]

Go to Display Templates

clip_image004

Go to Search

clip_image005

Enable the publishing features if you only see .js files

clip_image006

Upload the master page at this location with the default settings.

Don’t forget to publish and approve this document!

Upload birthday.css

Go to the style library

clip_image001[11]

Create a new folder

clip_image002[9]

Upload the css document to this location.

Don’t forget to publish this version!

Set the css so it will be used at site settings -> Master Page (beneath Look and Feel) or add this using a script editor web part.

clip_image003[9]

Set the display template for the search web part

Edit the Search Result Web Part

clip_image001[13]

And use the Birthday Template

SNAGHTMLd387b2f

Download the birthday.html and .css

SharePoint: Unable to retrieve topology component health states

We encountered the below error during a fresh SharePoint 2013 installation using AutoSPInstaller.

image

‘Unable to retrieve topology component health states. This may be because the admin component is not up and running.’

I have seen a few blogs that mentions this error but most of them provided a solution which isn’t really helpful like an complete reinstall of the SharePoint farm. I have also seen a few who say to delete the Search Service Application (SSA), restart the servers and recreate the SSA; this could solve the issue for some but unfortunately this was not the case for my SharePoint 2013 farm.

Solution

In my scenario we resolved this issue by provisioning the WSS Usage Application Proxy using the following PowerShell commands:

$UP = Get-SPServiceApplicationProxy | where {$_.TypeName -like "Usage*"}
$UP.Provision()

Other possible solutions we used during other installations

1. Removing the extra space at the end of ‘PSModulePath’

Go to the System Properties

image

Environment Variables…

image

Edit PSModulePath

image

And remove the space. Restart HostControllerService after this change.

2. Set the service accounts again in Central Administration

It is also possible the Service Account did not fully provision itself during configuration of the Search Service Application.

Go to the Security tab in Central Administration

image

Configure Service accounts

image

Verify if the correct service account is present and just click on OK. Start an IISReset and verify if the states are visible again.

SharePoint 2013 search error ‘Sandbox worker is closed’

I encountered the following error while crawling our site collections.

Processing this item failed because of an unknown error when trying to parse its contents. (Error parsing document ‘<doc>’, Sandbox worker pool is closed ; ; SearchID = <GUID>

Only titles of document were crawled using search which resulted in search only showing titles and Office Web Apps preview wasn’t working.

Solution
I have granted the service account the proper permissions and configured the service account correctly using Central Administration –> Security –> Configure Service Accounts

image

image

You can first try to use the farm account because this service account should have the appropriate permissions. The errors were gone after a full crawl of all content sources and search was working again.

image