cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sharepointuser1
Helper I
Helper I

SharePoint Calendar - Recurring Event and Create Item Action

Help! I created an out-of-office calendar for work and have issues when an event is recurring.

 

I have a Request Time Off calendar where different teams submit their request in this one calendar and once approved, it creates/posts the item to their respective team's out-of-office calendar. For example, a person from the Admin Team submit a request through the Request Time Off calendar and got approved by the manager, the request will now be posted in both the Request Time Off calendar and the Admin out-of-office calendar.

 

Everything's working fine except I noticed that when an event is recurring - the recurring settings don't carry over on the individual team's calendar. For example, if someone requests time off every Wednesday starting today the 23rd till the end of next month and got approved, it will show up on the team's OOO calendar as the range of the recurrence Feb 23 - March 30 instead of just every Wednesday - Feb 23, March 2, March 9 so on and so forth.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @sharepointuser1,

 

The challenge is that the when an item is created trigger action doesn't include the RecurrenceData field. You have to add another request in your flow to retrieve these values.

 

After that you could create a new event item in the target list with a Send an HTTP request to SharePoint action. 

 

Below is an example of that approach.

Btw, you can still reuse your create Item action in the If no section.

 

Uri to retrieve RecurrenceData of created item

_api/web/lists/getbytitle('Events')/items(@{triggerOutputs()?['body/ID']})?$select=*,Duration,RecurrenceData

 

Expression to retrieve fRecurrence field in the Condition action:

body('Send_an_HTTP_request_to_SharePoint_-_GET_RecurrenceData')['d']['fRecurrence']

 

Body for the creating the new event item in the target list. It includes an expression to retrieve the RecurrenceData (xml) value. The replace function is used to replace " by the ' character.

{
"Title": "@{triggerOutputs()?['body/Title']}",
"EventDate": "@{triggerOutputs()?['body/EventDate']}",
"EndDate": "@{triggerOutputs()?['body/EndDate']}",
"EventType": @{triggerOutputs()?['body/EventType']},
"fRecurrence": true,
"RecurrenceData": "@{replace(body('Send_an_HTTP_request_to_SharePoint_-_GET_RecurrenceData')['d']['RecurrenceData'], '"', '''')}"
}

 

recurrencedata_createitem.png

View solution in original post

9 REPLIES 9
Expiscornovus
Super User
Super User

Hi @sharepointuser1,


Can you share a screenshot of the current setup of your flow? This will help us to troubleshoot the root cause of your issue/challenge.

Yes, of course - thank you! @Expiscornovus 

 

sharepointuser1_0-1645763480046.pngsharepointuser1_1-1645763496467.png

 

Expiscornovus
Super User
Super User

Hi @sharepointuser1,

 

The challenge is that the when an item is created trigger action doesn't include the RecurrenceData field. You have to add another request in your flow to retrieve these values.

 

After that you could create a new event item in the target list with a Send an HTTP request to SharePoint action. 

 

Below is an example of that approach.

Btw, you can still reuse your create Item action in the If no section.

 

Uri to retrieve RecurrenceData of created item

_api/web/lists/getbytitle('Events')/items(@{triggerOutputs()?['body/ID']})?$select=*,Duration,RecurrenceData

 

Expression to retrieve fRecurrence field in the Condition action:

body('Send_an_HTTP_request_to_SharePoint_-_GET_RecurrenceData')['d']['fRecurrence']

 

Body for the creating the new event item in the target list. It includes an expression to retrieve the RecurrenceData (xml) value. The replace function is used to replace " by the ' character.

{
"Title": "@{triggerOutputs()?['body/Title']}",
"EventDate": "@{triggerOutputs()?['body/EventDate']}",
"EndDate": "@{triggerOutputs()?['body/EndDate']}",
"EventType": @{triggerOutputs()?['body/EventType']},
"fRecurrence": true,
"RecurrenceData": "@{replace(body('Send_an_HTTP_request_to_SharePoint_-_GET_RecurrenceData')['d']['RecurrenceData'], '"', '''')}"
}

 

recurrencedata_createitem.png

Hi,

 

in the condition action, the expression below is equal to ? (undefined....)

body('Send_an_HTTP_request_to_SharePoint_-_GET_RecurrenceData')['d']['fRecurrence']

I tried with equals to TRUE but it doesn't copy like I wanted to:

In my SharePoint calendar A I create this event

 

Assepa_0-1650031785638.png

Assepa_1-1650031866187.png

 

Once the flow is triggered I have this result in my SharePoint Calender B

I don't have two seperate Event on 19 and 26, but one event that start on 19 till the 26

Assepa_2-1650032006675.png

 

 

Also is it possible to copy recurring event from SharePoint calendar to a SharePoint list ?  

 

Thanks!

HoshJack
Frequent Visitor

@Expiscornovus Thanks for your help!

 

I did some testing with recurring events and there is one issue I can't solve:

 

My flow works fine like this (repeat instances does not match with difference between start and end in this example but results are the same when it does)

CRM1.PNG

 

So the event gets created in my calendar but something is weird

 

CRM2.PNG

 

When I click on one of the events, an error occurs (It means like: That did not work. The item does not exist. It may have been deleted by another user.

 

CRM3.PNG

 

But if I open the list view of my calendar, I can see the event, open and even edit it

 

CRM4.PNG

CRM5.PNG

I noticed that if I change something and save the event, I now can open the single events in the calendar view.

Another (and probably my biggest problem) is that these events seem to do not get transferred into my synchronized outlook calendar.

 

Do you have any ideas on what is causing these two issues and how to solve it?

Expiscornovus
Super User
Super User

Hi @HoshJack,

 

Just to double check. I see you are using the following value as an EndDate 2022-05-25T12:00:00. 

 

But as far as understand from your settings you want to have use a daily recurrence pattern which stops after 4 repeats. Based on your start date should the EndDate value not be 2022-05-21T12:00:00? 

 

Or do you only want it to run on weekdays? In that case it probably needs to be the 23th and you need to include the Weekday='True' part to your RecurrenceData xml as well.

 

Can you try something like below and see if that makes a difference?

{
"Title": "TestWeekday",
"EventDate": "2022-05-18T07:00:00Z",
"EndDate": "2022-05-23T11:00:00Z",
"EventType": 1,
"fRecurrence": true,
"RecurrenceData": "<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><daily weekday='TRUE' /></repeat><repeatInstances>4</repeatInstances></rule></recurrence>"
}

 

Hi @Expiscornovus,

 

Thanks for your reply!

 

I tried your code and it still does not work.

As far as I understand, the enddate is not important for the request as long as I include the repeat instances.

Even if the start and enddates are matching with the repeats (with or without weekdays only), the events are created weirdly as described above.

So the events are created in my Sharepoint calendar but I can't open them unless I open the main event in the list view of the calendar and save it.

Maybe there is some information missing in my code but I can't find the problem.

Expiscornovus
Super User
Super User

Hi @HoshJack,

 

I am able to reproduce this issue now. So, I think you are right, there is missing something in the code, it is not storing the pattern correctly.

 

Let me have a look if I can find the cause. 

Navin21
New Member

Hey @Expiscornovus 

Did you find any solution? I am also facing the same issue.

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,271)