Welcome to AlanPs1.io

This blog documents some of what I do every day. If you are a Sys Admin, an IT Pro or a DevOps Professional you might just find it useful. The content you will find should suit the beginner, intermediate users as well as advanced users. Each post has some nuggets of joy. I hope you find some content that is useful.

The content is mostly relating to Office 365, PowerShell and Power Platform such as Flow & PowerApps. I will be sharing tech tips and tutorials mostly linked to Office 365 administration and showing you ways to automate business processes using Flow, PowerApps and PowerShell. My focus lies mainly with Office 365 and I use the necessary tools to work with data from the various Office 365 APIs and Microsoft Graph etc. You will see me use PowerShell and the Power Platform to harness data and hopefully do something useful with it. Then, as time goes on I should be able to introduce more Azure related content as my discovery of all things Azure progresses.

Flow: Stripping Unwanted Characters or Special Characters From a String

Hi All.

For those who may need a way to strip special characters from a string then here is a method using Microsoft Flow. You will create an array of special characters then iterate through your string data replacing any of the matching characters then outputting the sanitised string at the end. Whilst I am using a compose called "Compose Email Subject", this could be any string when you decide to incorporate this into your Flow.

So, we will take this: https://emea.flow.microsoft.com/manage/environments/

And make it this: httpsemeaflowmicrosoftcommanageenvironments

Here is the Flow.

The trigger I have used is a button, although this could just as well be any trigger. Once the concept has been grasped here it is likely that this will be built into your own existing Flow. It just helps using a button to test so maybe start by building like for like in order to grasp the concept before incorporating into your own process.

Now a "Compose" called "Compose Email Subject". This is used for you to test your own email subject or string of your choosing so you can determine if the sanitation is complete in your case. Please change the value to suit.


Now let's initialise 3 variables as below:

createArray('.','@','ß','²','³','µ','`','´','°','^','=','(',')','&','$','§', '~','#','%','*',':','<','>','?','/','|',' ')

The above can be changed to suit. For example, if you only want to strip out a colon and a slash you could have.


To follow best practice, create your own "Apply to each" and name it "Apply To Each InvalidCharacters", or a name of your choosing and within set 2 variables.

replace(variables('Sanitise'), item(), ")

To finish off, outwith the looping control (Apply to each) add a compose called "Compose Sanitised Subject", as below.

I hope this is helpful to you.

Any issues or questions, please reference this blog and post in Get Help with Microsoft Flow.

Happy Flowing!

Thanks, Alan

Flow: Send A Happy Birthday Email Message To Everyone In Your Organisation

Quite regularly I hear requests that centre around wishing users a Happy Birthday within an organisation. There is an extremely popular template within the Flow template gallery that does just that, it is called "Send a Happy Birthday email to employees on their birthday" and it uses a SharePoint list. It work's really well, although sometimes date formats can become an issue for the Flow implementer when they are imported from the list. Also, the organisation's users need to be added to the list itself in advance. Whilst that isn't a huge chore for most people, below is a process that requires no list and will send an email to every enabled user in your O365 tenant at 9am on the day of their birthday.

Sound, interesting?

Well, read on and follow the steps and you too will be able to implement this process.

Your email will look like this.

Pre-requisites: You will need a suitable Office 365 group. This may be an "All Users" group or a segmented group that only has users who have agreed to recieve such an email. Maybe it's a group that omits the CEO or those who may not celebrate their birthday. I will leave that to you to decide, but in this example a pre-configured "All Users" group is in use.

Here is the complete Flow.

Read More

Flow: Excel Formats Only | Save New Email Attachments to SharePoint

If you want to save just "Excel files" or just "Word Files" to a SharePoint Library, then multiple file formats must be considered. Excel has several formats and so does Word although below are the most common types that you are likely to receive by email.

MS Excel = .xlsx, .xls, .csv (and others)

MS Word = .docx, .doc (and others)

When using "Dynamic content", a common way to get the file name is to use "Attachments name" from the "Get email" action. This is great and very simple, but what if you already have files of the same name in that location?

The answer, it will overwrite the old file. This may be what you want and if so great, but what if a system generates a file called "report.csv" every day and sends it to you. You may want to keep a hold of all the reports.csv version that arrive daily.

Wouldn't it be better to save reports.csv as reports-2019-03-08-19-15-20.csv so that each new version doesn't conflict with the last?

This is ultimately what we will achieve in this how-to Flow blog post.

The method I will now step through triggers on receipt of a new email, captures the file format then adds a time stamp to the end of the file name on save.

Here is the completed Flow.

Read More

Flow: Create Planner Task and Include Attachments From Outlook Email

Hi everyone. One of the many great things about being a Flow Community Contributor and having a love for building Flows, is that there are countless opportunities to create Flows for others. In this blog post, I will take you through a real word example where our community member js4 had asked for guidance on how to create planner tasks from email. This request came in three tranches, presumably as the potential for Microsoft Planner working with Flow, as an engine, became clearer and clearer as we stepped through the processes. You can find js4's post here.

It then became apparent to me after searching our forum, others were requesting extra functionality from Planner and Flow also. Please see the following link.

Planner attach document from Outlook email

With 94 up votes and posts as recent as January 24th 2019, I thought I'd give this a go as I could see it's feasibility, despite no template or process for it as of yet.

So here is some information on the Flow before I step you through each action and how to create this for yourself. Oh, and don't forget, this Flow will still be created and updated with a suitable description from the body of the email if there are no attachments.

Note: Where I have used expressions, or even if there may be potential questions asked around what action provided the value for the dynamic content, I will feature these directly below each image in order. There will be times when the comments section of the action holds this data too.

Prerequisites: The use of a SharePoint Document Library is required. From Documents(Shared Documents), I have added a folder called "PlannerDocs". You may want to create this for consistency and to make it easier to follow along.

Read More

Flow: The Sweetest Graph Call You've Ever Seen – Hiding Data in Flow

Hi everyone. Calling APIs from Microsoft Flow is a key part of what I use it for, as it allows me to harness data from the cloud and do useful things with it. More often than not, it helps with the creation of automated processes linked to Office 365, SharePoint and Azure, that I do so much with. Whilst doing my thing in the Flow Community Forum, I stumbled across a post from community member Roger365.

He names his post "HTTP OAuth with Client Secret" and goes on to say.

"Why do i see the client-secret as plaintext in the "Secret" field? If i would share my FLOW the other users, they will also get the client-secret. Why is that field not of type "password"? (So the value will not shown as plain-text.). At now, the secret can be reused and for me its a security issue."

Here is the post

He makes a valid point, although these fields are not password fields as they are able to take dynamic data and expressions so it is likely for that reason they are the way they are. There is no obvious way to hide data in Flow, but when I read a post from everyone's favourite #FlowNinja he put me well and truly on the scent for hiding data. Kudos to John Liu for all his wonderful insight relating to Flow generally.

So here is how I now approach hiding values and in this example I will use it to make "The Sweetest Graph Call You've Ever Seen", for now anyway.

Read More