Simple and powerful single screen app for new Office 365 group requests

In a previous post Embed a Power App on a SharePoint page, I shared how I like to deploy apps by embedding the apps in SharePoint. I find it to be one of the easiest ways to distribute an app to a wide audience for access on primary devices with very little need for end-user training. A few comments from that post requested more information about the app itself. In this post, I’ll provide some details about the app and some background.

First, I’m a busy woman but I’m not sure anyone else knows that. If you are like me and in I.T. you may receive countless email messages asking for the most mundane stuff like creating Office 365 groups all day and everyday.

First, there is absolutely no reason why we, personally, have to create Office 365 groups. So don’t. This blog post is here to help you to stop the madness.

My Group Request Form

My little app looks simple and it is. It’s just a single page app. As you can see from the image on the right, there are only a few input fields.

Don’t let the simplicity fool you. This is a powerful little front-end for a more extensive process.

Notice how two of the fields have an asterisk “*” next to the field name. Those fields are required but what’s even better than that is the app controls the input for a couple of fields.

For transparency’s sake, I admit to being a natural skeptic. When I built this app I thought quite a while about the four fields shown here and I still see ways I can perfect them. First, I thought about the names of groups and how often duplicate group names are requested. So the New Group Name field not only requires a name but it evaluates the name of the group in case it already exists.

See it in action

See how the custom error appears when a new group name is the same as one that already exists and the Submit button is disabled to prevent submission of a duplicate group name.

Notice how the group email address is automatically formatted and is view-only. End-users cannot edit the address.

Another big concern was the tendency for end-users to request groups with very inappropriate names or for inappropriate purposes. Instead of worrying about that, I recommend collaborating with your PMO office and/or Data Governance and Compliance teams. This way you can use an approval process powered by Power Automate to get policy maker eyes on groups and their purpose before groups are created.

In my app, the expiration date is not a required field but it could be grounds for denying the group request. The idea behind this is to automate other parts of group existence, like removing groups that are no longer needed, in the future.

Set up the custom error in two steps

  1. To get started, I edit the app’s Onstart property by adding the following code:

    ClearCollect(GetAllGroups,'Organizational Groups'); NewForm(EditForm1)

    With this code, I create a new collection called GetAllGroups. The collection contains all of the groups listed in the SharePoint list called Organizational Groups. Feel free to swap my italicized names with the names for your collection and SharePoint list.
  2. Next, in the EditForm, select the error label within the applicable data card and replace the existing code with the following:

    If(DataCardValue1.Text in GetAllGroups.Title,"This group already exists. Duplicates are not allowed.")

    This code looks at the text in the input field called DataCardValue1 and checks for that text in the Title column of the my GetAllGroups collection. If the same text exists in the Title column then the error text – “This group already exists. Duplicates are not allowed.” is shown. If the text does not exist then no error is displayed.

Set up the group email address in one step

In my example, the group email address appears as an uneditable label. As the user types in the input field the label changes. Use this code in the Text property of your address label to duplicate the idea in your project:

Substitute( DataCardValue1.Text, " ", "_" )

This code takes what is typed by the user in DataCardValue1 and substitutes spaces with underscore characters. I did this because it is natural for users to type spaces between words but group addresses do not allow them.

According to Microsoft, you can only include letters, numbers, and the following special characters: underscore, dash, single quotes and period in the name of a group.

This way, users don’t have to know the rules. In my case, it was imperative that I addressed this issue because I use Power Automate to actually create the group after the request is approved and this idea will increase the likelihood of successful flow runs.

Set up the submit button in two easy steps

  1. First, make sure that the submit button does something when it is selected. In the OnSelect property for the button enter the code:

    SubmitForm(EditForm1); NewForm(EditForm1)

    This code submits my form called EditForm1 and after the form is submitted a new blank form is ready for use.
  2. Next, I change the button’s display mode so that is not available for use until conditions are right. In the DisplayMode property for the button use this code:

    If(DataCardValue1.Text in GetAllGroups.Title, DisplayMode.Disabled,Edit)

    This code looks at the text in the input field called DataCardValue1 and checks for that text in the Title column of the my GetAllGroups collection. If the same text exists in the Title column then the button is disabled. If the text does not exist the button is enabled in edit mode.

That’s it! With this form embedded on a SharePoint site, users can easily request new groups.