I am trying to figure out how to get a gallery that is connected to a Teams channel to refresh every time a new message is added. As of right now every time a new message is added to the Teams channel it does not automatically show upin my PowerApp.
Got it. I did notice an odd behavior when the gallery loads up. Some of the older messages do not show. Is there a reason why? I have/had a bunch of deleted messages in between. Does that have something to do with it or is there a limit to how far back Powerapps will pull messages?
Hi @Future_Vision ,
Not quite matters just in case. Using variables to store Gallery.Selected could help clearly know which Gallery item has been selected if there are multiple Galleries.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Why would Gallery.Select value be lost? I'm not sure if it matters. This gallery is strictly a 'dashboard' to view what is basically a change history.
Hi @Future_Vision ,
I'm afraid there is no way to refresh the Gallery "every time a new message is added". But you could try and add a Timer to collect the result like every 5 seconds as the workaround.
So, steps are as follows:
1\ Add a Timer Control, set duration as 5000 (milliseconds),
2\ OnTimerEnd of the Timer set to:
ClearCollect(colMessages,MicrosoftTeams.GetMessagesFromChannel(Gallery1.Selected.id, Gallery1_1.Selected.id).value)
3\ Use the collection as the data source of the Gallery.
4\ In case the Gallery.Select value is lost, you'd better create variables to store them.
Gallery1 select button:
Set(varGroup, ThisItem.id)
Gallery1_1 select button:
Set(varChannel, ThisItem.id)
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional