cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
diplalseta
Regular Visitor

Create a calendar event when a folder is created

Greetings all, 
In our teams' shared Sharepoint site, there is a naming convention in place defining how folders are created in the "Events" folder: "YYYY-MM-DD Event Name". For example, 2022-11-25 Student Workshop. Would it be possible to create a flow to add a calendar event? In this case, on the 25-11-2022 create an event called Student Workshop on the shared team calendar. We then intend to put this on a page amongst other team announcements.. 

 

 

Thank you 
Dip

7 REPLIES 7
Expiscornovus
Super User
Super User

Hi @diplalseta,

 

You could use the substring function to retrieve the first 10 characters of the folder name.

 

Below is an example.

This example assumes you are only creating event folders which always start with a date. If that is not the case you need to build in some checks if the folder name starts with a date or not

 

1. In the settings of the When a file is created (properties only) trigger action make sure you add the following expression as a trigger condition

This way the flow will only be triggered if the item is a folder

@triggerOutputs()?['body/{IsFolder}']

 

2. In the Create Event (v4) action use the following expression for both the start time and end time fields

formatdatetime(substring(triggerOutputs()?['body/{Name}'], 0, 10), 'yyyy-MM-ddTHH:mm:ss')

 

substringfunction.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


diplalseta
Regular Visitor

Hi @Expiscornovus 

Thank you so much for your response. 

I have made a step forward however have been met with a barrier. The events folder not always has a folder starting with the date - inside it there are also archive folders e.g. 2020 archive. Sample below: 

diplalseta_0-1669770673759.png

 

I do believe this might be the reason the flow breaks: 

diplalseta_1-1669770832120.png

Lastly, I was wondering whether I would need full access to the Sharepoint mailbox to be able to create events on the shared calendar? 

diplalseta_2-1669771307572.png

This is the group calendar that we wish to embed in a page, however with a 30 day view if possible, and all events to be automatically within it using the flow above.. 

Is this something that is achievable? Thanks for all your help! 

 

 

Regards,
Dip



Expiscornovus
Super User
Super User

Hi @diplalseta,

 

The reason that you are getting the error is because you have added the expression as plain text/string. Can you please add the expression via the expression tab to the start time and end time fields?

 

add_viaexpressiontab.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


diplalseta
Regular Visitor

Hi @Expiscornovus.. 

Rookie mistakes on my part... The flow now runs successfully: 

diplalseta_0-1669857778517.png

But I am not sure where to find it on the calendar?

diplalseta_1-1669857862294.png

 

Thank you again for your unconditional support.

 

 

Regards,
Dip

diplalseta
Regular Visitor

Update: 

I am able to view the event on my personal calendar, however would like it on the shared Sharepoint site calendar - so it can be seen on the web part. 

diplalseta_0-1669859331057.png

 

Unfortunately these are my only options for the calendar id: 

diplalseta_1-1669859433500.png

 

Regards,
Dip

Expiscornovus
Super User
Super User

Hi @diplalseta,


That requirement makes the setup slightly more challenging because Shared Calendars are not supported in the Office 365 Outlook connector:

https://learn.microsoft.com/en-us/connectors/office365/#general-known-issues-and-limitations

 

A workaround would be to use the Create Event method from the Graph API though:

https://learn.microsoft.com/en-us/graph/api/calendar-post-events?view=graph-rest-1.0&tabs=http

 

That would mean you have to replace the Create Event (v4) action by one of the HTTP actions and interact with the Graph API instead.

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


diplalseta
Regular Visitor

Hello @Expiscornovus 

 

I thought that it would be easier to create an Excel file with a Calendar template, with each month in a different tab: 

diplalseta_0-1670311270354.png

Would it possible to set up a flow to add data into this Excel sheet (Calendar)?  



Regards,
Dip

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,299)