web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Book a room template -...
Power Apps
Answered

Book a room template - how to keep original text when booking for an existing meeting

(0) ShareShare
ReportReport
Posted on by 20

This great template seems to work fine for new meetings.

But for booking an existing meeting, the code below OVERWRITES original invitation body: agenda+join in MS teams link:

 

 

If(
 IsBooking,
 UpdateContext({ShowLoading: true});
 Set(AvailableRoomsCounter, 1);
 If(
 !BookForMeeting,
 Office365.V2CalendarPostItem(
 MyCalendar,
 User().FullName & "'s Booking",
 StartDateTimeUTC,
 EndDateTimeUTC,
 {
 RequiredAttendees: RoomsGallery.Selected.Email,
 Location: RoomsGallery.Selected.Name,
 Importance: "Normal",
 ShowAs: "Busy"
 }
 ),
 ClearCollect(
 RequiredAttendeesNoRoom,
 Split(
 MeetingsGallery.Selected.RequiredAttendees,
 ";"
 )
 );
 ForAll(
 AllRooms,
 RemoveIf(
 RequiredAttendeesNoRoom,
 Address = Result
 )
 );
 ClearCollect(
 RequiredAttendeesNoRoom,
 Concat(
 RequiredAttendeesNoRoom,
 Result & ";"
 )
 );
 ClearCollect(
 RequiredAttendeesNoRoom,
 Split(
 First(RequiredAttendeesNoRoom).Value,
 ";;"
 )
 );
 Set(
 RequiredAttendeesFinal,
 First(RequiredAttendeesNoRoom).Result
 );
 Set(
 RequiredAttendeesTrue,
 RoomsGallery.Selected.Email & ";" & RequiredAttendeesFinal
 );
 Office365.V2CalendarPatchItem(
 MyCalendar,
 MeetingsGallery.Selected.Id,
 If(
 MeetingsGallery.Selected.Subject = User().FullName & "'s Skype Meeting",
 User().FullName & "'s Booking",
 MeetingsGallery.Selected.Subject
 ),
 StartDateTimeUTC,
 EndDateTimeUTC,
 {
 RequiredAttendees: RequiredAttendeesTrue,
 OptionalAttendees: MeetingsGallery.Selected.OptionalAttendees,
 Body: "Room has been updated to " & RoomsGallery.Selected.Name,
 Location: RoomsGallery.Selected.Name,
 Importance: "Normal",
 ShowAs: "Busy"
 }
 )
 );
 UpdateContext({ShowLoading: false})
);
Set(
 IsBooking,
 false
)

 

 Please help me to correct the code.

 

Thanks a lot. 

Categories:
I have the same question (0)
  • FabianAckeret Profile Picture
    975 on at

    Hi @MaratDK 

     

    Do you need to add some additional text to the already existing body? If not, you can just leave "body" out - I think that should work (I didn't try though). Like so:

    If(
     IsBooking,
     UpdateContext({ShowLoading: true});
     Set(AvailableRoomsCounter, 1);
     If(
     !BookForMeeting,
     Office365.V2CalendarPostItem(
     MyCalendar,
     User().FullName & "'s Booking",
     StartDateTimeUTC,
     EndDateTimeUTC,
     {
     RequiredAttendees: RoomsGallery.Selected.Email,
     Location: RoomsGallery.Selected.Name,
     Importance: "Normal",
     ShowAs: "Busy"
     }
     ),
     ClearCollect(
     RequiredAttendeesNoRoom,
     Split(
     MeetingsGallery.Selected.RequiredAttendees,
     ";"
     )
     );
     ForAll(
     AllRooms,
     RemoveIf(
     RequiredAttendeesNoRoom,
     Address = Result
     )
     );
     ClearCollect(
     RequiredAttendeesNoRoom,
     Concat(
     RequiredAttendeesNoRoom,
     Result & ";"
     )
     );
     ClearCollect(
     RequiredAttendeesNoRoom,
     Split(
     First(RequiredAttendeesNoRoom).Value,
     ";;"
     )
     );
     Set(
     RequiredAttendeesFinal,
     First(RequiredAttendeesNoRoom).Result
     );
     Set(
     RequiredAttendeesTrue,
     RoomsGallery.Selected.Email & ";" & RequiredAttendeesFinal
     );
     Office365.V2CalendarPatchItem(
     MyCalendar,
     MeetingsGallery.Selected.Id,
     If(
     MeetingsGallery.Selected.Subject = User().FullName & "'s Skype Meeting",
     User().FullName & "'s Booking",
     MeetingsGallery.Selected.Subject
     ),
     StartDateTimeUTC,
     EndDateTimeUTC,
     {
     RequiredAttendees: RequiredAttendeesTrue,
     OptionalAttendees: MeetingsGallery.Selected.OptionalAttendees,
     Location: RoomsGallery.Selected.Name,
     Importance: "Normal",
     ShowAs: "Busy"
     }
     )
     );
     UpdateContext({ShowLoading: false})
    );
    Set(
     IsBooking,
     false
    )
  • MaratDK Profile Picture
    20 on at

    Hi @FabianAckeret 

    Thank you so much for your quick suggestion.

    I have just tried your proposal and the result of leaving body out is that original body gets deleted completely and the new invitation has no text at all.

    How is it possible to persist the original body to the new invitation?

    Thanks a lot!

  • FabianAckeret Profile Picture
    975 on at

    Hi @MaratDK 

     

    The selected meeting is in the gallery MeetingsGallery. The body is also available... so, to get the existing body, you can do this:

     

    If(
     IsBooking,
     UpdateContext({ShowLoading: true});
     Set(AvailableRoomsCounter, 1);
     If(
     !BookForMeeting,
     Office365.V2CalendarPostItem(
     MyCalendar,
     User().FullName & "'s Booking",
     StartDateTimeUTC,
     EndDateTimeUTC,
     {
     RequiredAttendees: RoomsGallery.Selected.Email,
     Location: RoomsGallery.Selected.Name,
     Importance: "Normal",
     ShowAs: "Busy"
     }
     ),
     ClearCollect(
     RequiredAttendeesNoRoom,
     Split(
     MeetingsGallery.Selected.RequiredAttendees,
     ";"
     )
     );
     ForAll(
     AllRooms,
     RemoveIf(
     RequiredAttendeesNoRoom,
     Address = Result
     )
     );
     ClearCollect(
     RequiredAttendeesNoRoom,
     Concat(
     RequiredAttendeesNoRoom,
     Result & ";"
     )
     );
     ClearCollect(
     RequiredAttendeesNoRoom,
     Split(
     First(RequiredAttendeesNoRoom).Value,
     ";;"
     )
     );
     Set(
     RequiredAttendeesFinal,
     First(RequiredAttendeesNoRoom).Result
     );
     Set(
     RequiredAttendeesTrue,
     RoomsGallery.Selected.Email & ";" & RequiredAttendeesFinal
     );
     Office365.V2CalendarPatchItem(
     MyCalendar,
     MeetingsGallery.Selected.Id,
     If(
     MeetingsGallery.Selected.Subject = User().FullName & "'s Skype Meeting",
     User().FullName & "'s Booking",
     MeetingsGallery.Selected.Subject
     ),
     StartDateTimeUTC,
     EndDateTimeUTC,
     {
     RequiredAttendees: RequiredAttendeesTrue,
     OptionalAttendees: MeetingsGallery.Selected.OptionalAttendees,
     Body: MeetingsGallery.Selected.Body,
     Location: RoomsGallery.Selected.Name,
     Importance: "Normal",
     ShowAs: "Busy"
     }
     )
     );
     UpdateContext({ShowLoading: false})
    );
    Set(
     IsBooking,
     false
    )

     

    I hope this helps.

    Kind regards,

     

  • MaratDK Profile Picture
    20 on at

    Hi @FabianAckeret ,

    You are so good. We are reaching the destination hopefully soon 🙂

    Now the text is there as pure html code - it looks like this:

    <html>

    <head>....

     

    How can we parse it as html?

     

    Thanks a lot.

  • Verified answer
    FabianAckeret Profile Picture
    975 on at

    Hi @MaratDK 

     

    This took me over an hour to find out... phew! 

    The behavior was super weird and I kept asking myself, why it converts the existing html body into a completely different html body. I then realized that the body of the V2CalendarPatchItem can only send a string (check documentation here) and not Html! And since V2CalendarPatchItem is deprecated, I simply replaced it with V4CalendarPatchItem. V4 supports Html as for the body.

     

    This will work. You can see that the timezone has been set to "UTC". If this doesn't suit your needs, feel free to adjust it.

     

     

    If(IsBooking,
     UpdateContext({ShowLoading: true});
     If(!BookForMeeting,
     Office365.V2CalendarPostItem(MyCalendar, User().FullName & "'s Booking", StartDateTimeUTC, EndDateTimeUTC, 
     {RequiredAttendees:RoomsGallery.Selected.Email, Location: RoomsGallery.Selected.Name, Importance: "Normal", ShowAs: "Busy"}),
     
     ClearCollect(RequiredAttendeesNoRoom, Split(MeetingsGallery.Selected.RequiredAttendees, ";"));
     ForAll(AllRooms, RemoveIf(RequiredAttendeesNoRoom, Address = Result));
     ClearCollect(RequiredAttendeesNoRoom, Concat(RequiredAttendeesNoRoom, Result & ";"));
     ClearCollect(RequiredAttendeesNoRoom, Split(First(RequiredAttendeesNoRoom).Value, ";;"));
     Set(RequiredAttendeesFinal, First(RequiredAttendeesNoRoom).Result);
     Set(RequiredAttendeesTrue, RoomsGallery.Selected.Email & ";" & RequiredAttendeesFinal);
     Office365.V4CalendarPatchItem(MyCalendar, MeetingsGallery.Selected.Id,If(MeetingsGallery.Selected.Subject = User().FullName & "'s Skype Meeting", User().FullName & "'s Booking", MeetingsGallery.Selected.Subject), StartDateTimeUTC, EndDateTimeUTC, "UTC", {requiredAttendees: RequiredAttendeesTrue, optionalAttendees: MeetingsGallery.Selected.OptionalAttendees, body: MeetingsGallery.Selected.Body, location: RoomsGallery.Selected.Name, importance: "Normal", showAs: "Busy"})
     );
    
     UpdateContext({ShowLoading: false})
    );
    Set(IsBooking, false)

     

     

     

    I hope this helps.

     

    Kind regards,

    Fabian

     

  • MaratDK Profile Picture
    20 on at

     

    Hi @FabianAckeret ,

    Thank you very much. I really appreciate your efforts.

    The newest code returns error 😞

    I have been trying to compare the two and can see that there are these changes:

    1) Set(AvailableRoomsCounter, 1); is removed in the new code.

    2) EndDateTimeUTC,   is changed to EndDateTimeUTC, "UTC", 

    3) Office365.V2CalendarPatchItem changed to Office365.V4CalendarPatchItem

    I understand that the last change is the one that should solve the problem.

    However even when I try to change only V2 to V4 in the existing working code, I get error:

    V4 is simply missing. See the attached printscreen.

    Are connectors tenant specific? Can it be that V4 is not yet rolled out in our tenant?

     

    A side question: what is the name of the language in PowerApp? Is there are tool to beautify/format it? Ala https://www.daxformatter.com/? 

     

    2020-11-29 21_49_56-Window.png

     

  • FabianAckeret Profile Picture
    975 on at

    Hi @MaratDK 

     

    The content of Office365.V4CalendarPatchItem is case sensitive. If you look at requiredAttendees, optionalAttendees, body, location, importance, and showAs you can see that they start all with a lower first letter. Unlike with the V2 version. If you didn't adjust those then this is what is causing the error on your end. The V4CalendarPatchItem also requires the timezone, hence the added "UTC".

     

    Regarding Set(AvailableRoomsCounter,1):

    I simply used the newest template of Book A Room. In there, there is no such variable anymore. However, I've added it again below code (in case it's a variable you created...). Also, I updated the Office365.V2CalendarPostItem to Office365.V4CalendarPostItem.

     

    If you copy the whole code, it should definitely work.

    If(IsBooking,
     UpdateContext({ShowLoading: true});
     Set(AvailableRoomsCounter, 1);
     If(!BookForMeeting,
     Office365.V4CalendarPostItem(MyCalendar, User().FullName & "'s Booking", StartDateTimeUTC, EndDateTimeUTC, "UTC",
     {requiredAttendees:RoomsGallery.Selected.Email, location: RoomsGallery.Selected.Name, importance: "Normal", showAs: "Busy"}),
     
     ClearCollect(RequiredAttendeesNoRoom, Split(MeetingsGallery.Selected.RequiredAttendees, ";"));
     ForAll(AllRooms, RemoveIf(RequiredAttendeesNoRoom, Address = Result));
     ClearCollect(RequiredAttendeesNoRoom, Concat(RequiredAttendeesNoRoom, Result & ";"));
     ClearCollect(RequiredAttendeesNoRoom, Split(First(RequiredAttendeesNoRoom).Value, ";;"));
     Set(RequiredAttendeesFinal, First(RequiredAttendeesNoRoom).Result);
     Set(RequiredAttendeesTrue, RoomsGallery.Selected.Email & ";" & RequiredAttendeesFinal);
     Office365.V4CalendarPatchItem(MyCalendar, MeetingsGallery.Selected.Id, If(MeetingsGallery.Selected.Subject = User().FullName & "'s Skype Meeting", User().FullName & "'s Booking", MeetingsGallery.Selected.Subject), StartDateTimeUTC, EndDateTimeUTC, "UTC", {requiredAttendees: RequiredAttendeesTrue, optionalAttendees: MeetingsGallery.Selected.OptionalAttendees, body: "Room has been updated to " & RoomsGallery.Selected.Name, location: RoomsGallery.Selected.Name, importance: "Normal", showAs: "Busy"})
     );
    
     UpdateContext({ShowLoading: false})
    );
    Set(IsBooking, false)

     

    Kind regards,

     

  • MaratDK Profile Picture
    20 on at

    Hi @FabianAckeret ,

    Once again, thanks a lot.

    Indeed it seems that template has been changed within the last few days 😮

    Is there any metadata on when the template was published and by whom?

    Are you actually the guy behind this template ?

     

     

    Unfortunately I still get error: both when I try to use your code in my old app and the one I have just created from template (the one without Set(AvailableRoomsCounter,1):

     

    I did change capitalization last time - thanks for bringing this to my attention.

    This time I have copied exactly your code and I get this error.

     

    What am I doing wrong?

     

    2020-11-30 10_48_59-Window.png

  • FabianAckeret Profile Picture
    975 on at

    @MaratDK 

     

    Oh no, I'm not the guy behind this template 😋

     

    Did you go to the screen to adjust the formula directly or did you go through the process? If you didn't select a room in the room gallery, it might be the cause of the issue. 

     

    Can you also let me know the error message/screenshot when you hover with your mouse over the wiggly line on requiredAttendees?

     

    Furthermore, to troubleshoot, you can simply remove some of the attributes such as importanceshowAs, etc. and try and figure out whether one of those attributes is causing the issue. Weirdly, it works on my end. 

     

    Kind regards,

     

  • MaratDK Profile Picture
    20 on at

    Hi @FabianAckeret 

    I normally changed the code by selecting the "ConfirmationScreen" directly.

    I have now tried to remove all other code and only place Office365. 

    How come I only can see V2 and not V4?

    Please see below the errors I get:

    2020-11-30 21_57_59-Window.png2020-11-30 22_04_19-Window.png2020-11-30 22_04_33-Window.png2020-11-30 22_09_07-Window.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard