Article
0 comment

How to define default header image for Events in Communication Site and a user story

Not every one of our users works in marketing or is an expert in storytelling. Storytelling is a skill for the future, but like every skill, it doesn’t come overnight and requires training. I assume, like for many of my customers, have problems to find an appropriate image for the header.

On the other hand, to communicate what is happening around you is beneficial for the rest of the company too. Let me show you a use case why you use default images for events in communication sites first and how to solve this on this kind of site templates.

The use case and an end user perspective

Let’s say you are an employee and organise workshops. You are an expert on your topic, for example, finance, but you are not an expert in design or marketing. The most important feature of the communication sites for you is to announce upcoming events. To be more specific the event list.

You got your introduction to the communication site and how to add events. You create your first event. You insert all the essential information regarding your workshop on the page. You don’t have a suitable image for your header and even the person from the IT department doesn’t know what to choose. Better leave the background image untouched. The default background doesn’t look that bad and serves its purpose. The most important thing is the title is readable.

First event created

First event created

After you save the event you check the landing page, and the workshop is displayed there, but there is no background image.

First event shown on landing page

First event shown on the landing page

Next time you choose to use an image you found on the internet somewhere. Finance, Money, should work but this time you run into another problem. The title is not good visible anymore.

You check the landing page, and nothing has changed. The event doesn’t display the background. Any way you like that image in the header, and it looks not that bad either, you think.

Event with and without background image

Event with and without a background image in details page

You choose the image picker again on a new event, and you don’t see your recently uploaded picture, so you upload it again, an again and again with every new.

Image doesn't get displayed in picker dialog

The image doesn’t get displayed in picker dialogue

After a couple of workshops you created you start to think, isn’t there a better way to set the header image once and for all and all future event.

So you asked marketing what they think about your picture in the header. You get an okay to use this image but also tell you that you should be consistent in your communication. You have now your default image walk over to the IT department and tell them that you like to have it as a default image for all your upcoming events. What is their story from now on?

The solution

The modern experience in general currently aims for maximal flexibility, which in general is sometimes a good thing but sometimes our end-user searches for some guidance and help for consistency. To define a default image other than the one Microsoft provided is currently not an option. The solution for this end user request is to set up a Microsoft Flow.

Step 1 – Get Banner Image and Focal Point settings

The first thing you need to have is the default background-image with the correct focal point settings defined on one of the event pages. The easiest way to get the settings for the banner image is to use the REST API.

Just in case you are a power user and struggle with the next step I guess someone of the IT department can help you.

  • /sites/Finance/ – my Communication Site
  • /_api/web/lists/getbytitle(‘events’) – query the list
  • /items(3)/ – select the third list item in my case – you need to add your Item ID
  • /BannerUrl – the field that stores the header image and focal point of the header

 

Check result of REST query and copy the URL

Check result of REST query and copy the URL

Now you should only see the value of this ‘BannerUrl’ field in an XML. Copy the value inside the ‘d:Url’ XML Node and store it somewhere. The complete link points to the file you like to set as a background image and in addition the right position of the background image.

Step 2 – Create a flow

The next step is to create a flow that updates the ‘BannerUrl’ field for future events. The template to choose is ‘SharePoint when an item was created or modified’ and configure your site collection and list. The list, in this case, is ‘Events’.

Insert first step in your flow and register to events in the Event list

The next step is to update the item that has been created or modified and add the previously stored URL to the ‘BannerUrl’ field.

Update list item with Banner Url

Update list item with Banner Url

From now on for every new event, the same background gets assigned; even if the user chooses a different one.

Step 3 – Testing the flow

To test this Microsoft flow create a new event on the list and leave the banner image untouched.

New Workshop Item with untouched header image

New Workshop Item with untouched header image

Right after the new event item was saved the header image still shows the default image or defined image because the Flow needs to do its job first. After a while, a couple of seconds, refresh the page and you will see the default image.

Header image after Microsoft Flow was applied

From now on the same image will be used for any events of our finance department and the business can focus on the content of the page.

Finally

The use case I sketched, in the beginning, happened a couple of times throughout my thirteen years of branding projects and SharePoint. In the end for most departments and convenience issues default images was always a must.

Currently, there is no other way to define a default image for Events, but I guess this shows an excellent solution to force consistency. Mainly it doesn’t allow the end user to choose an impropriate background image because it will be overwritten by the flow anyway.