Mavention Anniversaries available in the Office Store

As pointed out in my previous post about the Mavention Birthdays building apps are really addicting. So while the Mavention Birthdays app was queued for approval I figured we could extend its functionality a bit by not only showing birthdays but also anniversaries. As SharePoint is providing us with a HireDate field that could (or should) be filled with the hire date for each employee we could use that information to write a query to retrieve all the anniversaries.However there is one minor thing that required us to write a completely different query instead of implementing it in the Mavention Birthdays. While birthdays are always stored with the year 2000 anniversaries will be stored using the actual date a person is hired. Therefor a query to retrieve all the anniversaries for the current (or next) month will require a query that is not bound by the year.

So that’s why we created a new app, slightly different app, the Mavention Anniversaries. The basics of this app are pretty similar to the Mavention Birthdays, it will render a list of upcoming anniversaries. Yet the underlying query is tailored to show the anniversaries for the coming and the next month (with a limit of course). Such a query can only be done using a text property instead of  DateTime property. By using a text version of the information present you can write a query that matches the current month (or the next for that matter). Lets say you have a HireDate for someone in the that is hired on 01-08-2010 (English format) this will result in a text version 2010-01-08T00:00:00.0000000Z and you can write a query that checks for part of the string. In our case: “01-”. We cannot search for parameters with a – as a start since the – is recognized as a separator (or as an exclusion of the term if you use without the quotes). For that matter the “HireDate:01-” will return you with everyone that has a hire date that is in January of any year. So with that it was a matter of tweaking the query to sort correctly (using another managed property for the HireDate but as a DateTime one instead of the text version, and making sure it all looks great.

Mavention Anniversaries App example

Besides that there is also a form of badging implemented where all users will get ‘badges’ based on their anniversary. This badge indicates the length of their anniversary, and will show 1 to 5 stars. The stars are handed out based on how long the anniversary is and are matched on the following criteria: longer then 1, 2.5, 5, 7.5 or 10 years a user will receive respectively their 1 to 5 stars.

In order to leverage the SharePoint 2013 Search you will have to do some manual configuration, so when you install the app you are asked to complete these steps before you will be able to see results. The steps differ between slightly between Office 365 and on premise: 

If you installed this app on-premise you need to complete the following configuration steps:

  1. Make sure you have a few profiles with hire data

    • Go to your Search Service Service Application and click Manage Search Schema

      • Click the New Managed Property link

        • Name the new property HireDate, and make sure to make it of Date and Time type

          • Check the boxes for Searchable, Retrievable and Sortable (active)

            • Then click the Add a Mapping button, search for SPS-HireDate and select the People:SPS-HireDate property

              • Click on the OK button to commit the changes

                • Click the New Managed Property link

                  • Name the new property HireDateText, and make sure to make it of Text type

                    • Check the boxes for Searchable, Queryable and Retrievable

                      • Then click the Add a Mapping button, search for SPS-HireDate and select the People:SPS-HireDate property

                        • Click on the OK button to commit the changes

                          • Make sure you have a few profiles with hire data, and that the Everyone option is selected for HireDate property
If you installed this app in Office 365 you need to complete the following configuration steps:
  1. Make sure you have a few profiles with hire data

    • Go to your Search Service Service Application and click Manage Search Schema