Posts

PowerApps - Hide Buttons & Objects based on Office 365 Group Membership

Image
This post shows how you can hide a button inside a PowerApp unless you are a member of a specific O365 Group Why A lot of PowerApps we build these days have two audiences:
The person filling out a formThe team managing the process The person filling out the form really only needs to do one thing.  Fill out a form, and trust it's been sent to the right people.
The team managing the process may have a review & approval process that they don't want regular staff to see.  They may have Power BI reports or other screens that should be kept private.
I am going to show you how you can hide these buttons & screens so that they are only accessible if you are a member of an Office 365 Group.
How1. Create Office 365 Group & get ID
First we need an Office 365 Group that we are a member of, and we need to retrieve it's ID.  Here's another post on how to get the ID: How to Quickly find the GUID of a O365 Group

2. We are going to create 2 buttons in a PowerApp, with the int…

Microsoft Flow - Convert AND Format DateTime from SharePoint for Australia

Image
Using DateTime fields from SharePoint can be a royal PITA.  Here's the simplest way I've found to do a quick conversion from UTC time to AUS time.

What
Using Flow, when you pull dates from a SharePoint list, even if they look right in SharePoint, they come out wrong in Flow.

Why
SharePoint Lists store DateTime values in UTC format behind the scenes in the database.  This means even if you have Regional Settings set up in SharePoint to show the correct DateTime in the list, when you pull the data out using other applications, it spits out in UTC.

We want to fix that.

How
The expression I use to quickly convert the timezone AND format it to the correct dd/mm/yyyy format is ConvertTimeZone().

This function expects the following information:
ConvertTimeZone(DateTimeString, SourceTimeZone, DestinationTimeZone, Format)

Here's an example I've used in an Email Action in Flow:
convertTimeZone(triggerBody()?['DateTimeFromSharePoint'],'UTC','AUS Eastern Standard …

Office 365 Groups - Quickly find the GUID of a O365 Group

Image
Looking for the GUID for a Office 365 Group and finding it slightly painful with PowerShell?

Here's my trick for quickly finding it.
I use Microsoft's Graph Explorer: https://developer.microsoft.com/en-us/graph/graph-explorer Navigate to the Graph Explorer & click the Sign-In button in left-navigationClick the 'Show More Examples' link in the left-navigationSelect 'Groups' from the right-hand popoutNow you should be able to click 'All Groups in my organization' on the left hand nav.  (You may need to add the permission 'Directory.Read.All' to your account.Use Ctrl+F in the response pane to quickly find the group and grab it's ID

Microsoft Flow - Create a Teams Message from an RSS Feed

Image
This is a nice simple Flow that I love!  If you work with a lot of different software and want to keep up to date on the latest changes without having to save all those pesky favourites to various RSS feeds/blogs, this is for you.

The great thing about this is, when you start posting it to Teams, now everyone can see when there is an update! 

It's only 3 steps, here's how:
Create a Blank FlowAdd the Trigger 'RSS - When a feed item is published'Add the 'Data Operations - Compose' action to create a nicely formatted message to send to teamsAdd the 'Teams - Post a Message' action, select your team & channel, and put the Compose Output into the Message box
I use this flow to keep up to date on all the latest Microsoft PowerApps news, see the screenshot below for my flow setup.


PowerApps - Building a Expanding Gallery with a Expanding Text Box

Image
I recently built a questionnaire PowerApp for a customer.  They had a bunch of questions where the expected answers could be anything from 50-500 words. The problem was when you put too many words into a text box, it gets scroll bars. eww.

I'm not against scrollbars for a whole screen, but for text boxes, yeah no. So here's what we did!
Added a 'Blank Flexible Height' Gallery to the PowerAppConnected it to my Collection of questionsAdded a label to display the questionAdded a text box to collect the answersSet the following text box properties:Mode: MultilineHeight: 40 * RoundUp((Len(TextInput1.Text)+0.01) / 90,0)What this does40 - how tall the text box is each time you meet the character limit for one line90 - How many characters it takes to move the 40px multiplier up roundup - ensures the returned number is only ever 1 rounded number.  This means the text box grows in chunks, instead of growing with each individual character typed.+0.01 - ensures that even if the text…

Microsoft Flow - Use the Take() Function to quickly test your loops

Image
The Take() function can be used to filter an array.  For example, if you have an Array with 1000 items in it, you can use the Take() function to only grab the first 5.
WhyOccasionally when you are building a Flow, you need to run a loop across a large array.  The loop can take hours to run depending on how many items are in the array and how many actions are in the loop.  Use the Take() function to quickly check that your loop will run successfully on a small subset of the array.
HowIn this example we are going to create an array of 10 numbers, and iterate through a subset of the array. The steps are as follows: Create an 'Initialize Variable' Action, and build an array with some values in it - here's some values for you: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]Create an 'Apply to Each' Action and do the followingclick in the blank text box, navigate to the 'Expression' Tab and type: take()now click on the 'Dynamic …

Microsoft Flow - Apply To Each Limitation (5000 items)

Image
What
Had a situation where I was pulling back 70,000 items in an array from a REST API call.  I wanted to create a SharePoint item for each of the items in an array, however the 'Apply To Each' action kept giving me the following error:

ActionFailed. An action failed. No dependent actions succeeded.
Why
This was due to a Microsoft Flow limitation. When you are using the Free Version of MS Flow you are limited to 5,000 items in a loop.  Explained here: https://docs.microsoft.com/en-us/flow/limits-and-config

Workaround
I tried my best to come up with a workaround, tried splitting up the array into batches of 5,000.  All to no avail.  in the end, gave up, and saved the array of items to a CSV and saved the CSV in a SharePoint Library instead.


body('Parse_JSON')?['applist']?['apps']


The only other alternative I could come up with is to grab the 'first 4999 items' from the array, which does work with an expression like this:  take(variable('array'…