Thursday, June 2, 2016

Remove duplicates in calendar overlays in Sharepoint

In Sharepoint calendar it is possible to have events of different categories and create separate views for each category. Also it is possible to create calendar overlays, i.e. combine these views to the single view where events from different categories will be displayed using different colors. However there is a problem with this approach that events in overlay will be duplicated by default. In this article I will show how to create these overlays and how to fix issue with duplicated events.

Let’s start from creating calendar overlays. At first we need to define event categories in List settings > Category field (choice) > specify needed categories. In our example we will use the following categories:

  • Meeting
  • Work hours
  • Business

After that create view for each category from the list ribbon Create view. For each view we create filter on Category field like shown on the following picture and use category as view name:

and repeat this step for each category. After that we can create calendar overlay. It is done also from ribbon Calendars overlay button which opens the following page:

As you can see by default it doesn’t contain any calendars. Click New calendar link here and specify Name, Color and View for the new layer in the calendar overlay. In order to populate calendar list and all created views we will need to create Resolve button first. Also it is good practice to use the same name for the overlay as view name (and as category name):

Also repeat this step for each category. After that our default calendar view will look like this:

Now let’s create one test event e.g. for Meeting category. It will look like this:

As you can see created event is duplicated in the view. In order to solve this issue we need to edit default calendar view as well and specify filter for Category field. We can set filter there that only events which don’t belong to any category should be shown there (Category is equal to “” (empty string)) or we may apply more complex filter and show only those events which don’t correspond to any mentioned categories. In last case if new category will be added in future events which correspond to this category will be displayed in the default view (unless separate view won’t be created and added to overlay. In this case you will need to add it to the filter of default view as well in order to not get duplicates again):

or

At the end calendar will look like this:

and as you can see there are no duplicates anymore.

No comments:

Post a Comment