Repeating Control in PowerApps 

Repeating controls functionality in PowerApps can be achieved using Gallery Control of PowerApps.  

Repeating control functionality can be useful in many scenarios. For Instance, you can add multiple products in data source, you can add multiple clients’ details in Data Source. 

In this article using repeating control feature we will save data of multiple employees in SharePoint List. In this example we will only use text input control. But we can use any control inside gallery for repeating control functionality. 

Now let’s start building the solution for Repeating Control in PowerApps.

Create SharePoint List 

Create “Employee Detail” list and create following columns: 

Column Name  Column Field 
Employee ID  Number 
Employee Name  Single line of text 
Employee Designation  Single line of text 
City  Single line of text 

Create PowerApps

Step 1: Create new canvas app.

Step 2: Add Label controls for the heading purposes in the screen that looks like as below and add “+” icon in the first column.

Step 3: After adding “+” icon set its “OnSelect” property as below:

Collect(
    DetailCollection,
    {
        Emp_ID: Text(Last(DetailCollection).Emp_ID + 1),
        Emp_Name: "",
        Emp_Des: "",
        Emp_City: ""
    }
)

Step 4: Now add Blank Vertical gallery control and add text input controls for each field (which are created in “Employee Detail” SharePoint list).

Select gallery control and set its “Items” property to the collection name:

DetailCollection

Step 5: Add Cancel icon in gallery to remove each row from gallery control. For that, set property on “OnSelect” property to:

RemoveIf(
    DetailCollection,
    Emp_ID = ThisItem.Emp_ID
)

Step 6: Now we will save the rows in the SharePoint list.
Insert button and set formula on “OnSelect” property.

ForAll(Gallery1.AllItems,Patch(
    'Employee Detail',
    Defaults('Employee Detail'),
    {
        'Employee ID': TextInput_ID.Text,
        'Employee Name': TextInput_Name.Text,
        'Employee Designation': TextInput_Des.Text,
         City: TextInput_City.Text
    }
)); 

Here we will patch all rows into SharePoint list.

Step 6: Now test the solution for new entries.

After click on “Save” button then go to the SharePoint list. You can see the new items have been created in list.

How to update properties of multiple controls inside PowerApps Form Control 

If we want to change the style of our DataCardKeys and DataCardValues in a Power Apps Form, then we must update the style of each of them one by one.

In this article we will see how we can update the properties (Font Size, Color, Fill) of multiple form controls (DataCardKeys and DataCardValues) altogether.

  • Let’s Start with the Power app form for the here the example we have taken the customize power apps forms, but the same trick will apply on the Power apps canvas application form.
  • Here the few steps to select multiselect control from to different data card.

1. Select the Power Apps form in the tree view

Now Click Select the form in this scenario we are using SharePoint Form because this is customization form.

2. Change the form layout property from vertical to horizontal

  • This section will demonstrate how to change the layout. To do this, first go to the right-pane, and select the Layout dropdown. Going through the list of layouts, find one fitting your needs. In this example, we will choose Horizontal.

3. Click the undo button

This trick only works if we click the undo button in the top right corner. Pressing Ctrl+Z to undo does not have the same effect.

4. Now all DataCardKeys and DataCardValues in the form are selected

  • This section shows a single form with multiple datacardValues and datacardKeys. The data card contains one or more dropdown list, radio buttons, checkboxes etc. By design, we can see the data card is selected and there are multiple controls inside each of the form’s data card.

5. Use the Tree View search to quickly unselect either the keys or values

  • Now, based on your requirement you can Press the ctrl button and you can deselect the control based on your requirement so if you want to change the DataCardValue property then you can unselect the DataCardKey it’s up to you if you want to selected Specific DataCardValue you can select that and changed the property based on your desired outcome.

6. Change any property of the remaining selected controls in one-click.

  • In this section, we can see how to make the many changes quickly as per the requirement DataCardKeys or DataCardValues in the DataCard.
  • In our requirement we want to increase the font size for all DatacardKey text in red color and Font Weight bold as well.
  • Here you can change the multiple selected control height, width, color padding, hover effect etc based on the requirement.
  • This tricks also work same as the canvas app form.

Power Apps Deep Linking

A Deep link is one type of hyperlink that send an app user to a specific record or screen. When a new record is added to a SharePoint list, a hyperlink will be sent for the submitted record through email.
In this blog post, I have shown the steps for how to send an email with deep links that immediately open Power Apps to a specific record or screen.

Now let’s start building the solution for deep links email direct link to specific record.

Introduction: Create an Issue Tracker App         

We will create one PowerApp for generate issue tracker through app and request send to help desk. After sending request help desk will resolve issue for requested user.

Setup The SharePoint List

First create SharePoint list for requested user request with the following columns:

Column NameColumn Type
TitleSingle line of text
IssueTypeChoice [Options: LAN, Mouse, Internet, Printer, Desktop, Laptop]
DescriptionMultiple line of text

Add necessary columns in created SharePoint list below shown in image.

Edit form in PowerApps

Let’s create one canvas app for create issue tracker for new user.
Add one label and connect data source then add SharePoint list (which created in SharePoint  site)

After adding data source take one “Edit Form” and connect SharePoint list as data source.

Add TitleIssue Type and Description fields in the form and delete unnecessary fields.

Change the DefaultMode as “new” because,  when we will submit form then new record will added to the SharePoint list.

“FormMode.New”

Submit Button For The Edit Form

Now, insert a new button below the form with the text “Submit”.
Add this code in the OnSelect property of the form to submit the form details to the SharePoint list.

“SubmitForm(Issue_Tracker_Form)”

Then add this code to the OnSuccess property of the form to define what happens after the new ticket is successfully created. We want to capture the ticket details in a variable called varIssueTicket, change the form to view-mode and then show a banner at the top of the screen to let the user know their ticket was saved.

“Set(varIssueTicket, Issue_Tracker_Form.LastSubmit);
ViewForm(Issue_Tracker_Form);
Notify("Success: Your issue ticket was submitted", NotificationType.Success);”

Put variable name on Item property of form

“varIssueTicket”

Use this code on Visible property of the submit button to hide it after the ticket is submitted.

“Issue_Tracker_Form.Mode<>FormMode.View”

Get the PowerApps URL

Now generate link to the submitted ticket we must first obtain the app’s web link.

Copy “Web link” into notepad. We will need it in Power Automate flow action.

Send Deep Link in Email using Power Automate

After submitting user request through powerapp help desk will receive an email with direct link.
Go to the Power Automate and build one cloud flow will send email to helpdesk for submitted request. Choose “When an item is created” for the trigger.

Add two actions in the flow: “Compose” and “Send An email V2(Outlook)”.

In the compose step of the flow we are writing HTML code to insert into the body of the notification email. We take the web link for the app and add a URL parameter called issueticketid. This parameter is filled with the unique ID number from the SharePoint list.

“<html>
<body>
You submitted an issue ticket.  To check the details of your issue ticket please click on the link below.<br>
<br>
<a href="https://apps.powerapps.com/play/a2b869be-a044-4c78-b0a8-f58c79a6a3b3?tenantId=a74c513c-bb62-4ec9-99ea-ed1688d1a1fa&issueticketid=@{triggerOutputs()?['body/ID']}">Link To Issue Ticket</a>
</body>
</html>”

After add html code in compose action then add send email action put output in body section then save the flow.

Get Item ID in App OnStart Property

When the app opens it must check whether a record ID was supplied inside the issueticketid URL parameter. If issueticketid has a value, the form should display that record, otherwise, it will appear blank.

Use this code in the OnStart property of the app. It performs a lookup on the issueticketid URL parameter and stores the result in the varIssueTicket variable. If a record was found it changes the form to view mode (instead of new mode which is the default we setup earlier).

“Set(varIssueTicket,LookUp('Issue Tracker',ID = Value(Param("issueticketid"))));
If(!IsBlank(varIssueTicket),
ViewForm(Issue_Tracker_Form))”

When the form is in new mode the titlebar will show the text “Create An Issue Tracker”, otherwise, it will display the ticket ID number. Use this code in the Text property of the titlebar.

“If(Issue_Tracker_Form.Mode=FormMode.New,"Create An Issue Tracker","Issue Ticket #"&varIssueTicket.ID)”

Submit Form To Send An Email

Now test the app first fill the form which is created in powerapps, after submitting form email sent though direct link to the submitted record.

After submitting form waiting for few moments and an email will appear with direct link to issue ticket record.
Click on the link mention in email.

When we click on the link app open with the form in view-mode and display the issue ticket details.

How to Calculate Business Days Excluding Weekends & Holidays in power Apps

  • Dealing with the date is very headache for some time specially for calculate the business days excluding weekends is very tuff for some time and most of the business power apps calculating the business days between two days is a common feature.
  • For the Calculate the date fist we get all dates and filtering the weekends and holidays. There is not the direct solution or function available to calculating the number of business days.
  • This article will help you to calculating the number of business days.

Introduction: The Leave Requests App

  • The Leave Requests App is used by employees at a financial services firm to ask for the vacation sick leave for paid time off.
  • For the Leave Request Apps need to be much information like leave status, Approval name Employee Department etc. but here our agenda is the calculated number of businesses days so here we take only necessary columns.

Setup A SharePoint list for leave Requests

  • Create a new SharePoint list called Leave Requests with the following columns:
    •  
    •  
  • Employee Name (People Picker)
    • Start Date (date only)
      • End Date (date only)
        • Number Of Days (number)
          •  

Create A New Canvas App in Power Apps Studio

  • Create new app from blank.
  • Insert the Edit form and add button on the screen
  • Connect the form with Data Source as Leave Requests.

 

After the adding data source in edit form. Now you can add the number of days data card to make it view only.

Calculate The Number of Business Days Excluding Weekends in Power Apps

  • When Employee enter the Leave request Start Date and End date into the power apps form. For the business day means the Monday – Friday weekdays and not the Company holidays.
  • Now we can start the calculate number of business day excluding the weekends.
  • For calculating we can use With function and Sequence function for calculating business days.
  •  Just overview of With function: With holds the value from these functions long enough to be used in further calculations or actions.
  • Sequence function: This function is generated single columns table of Sequence numbers like 1,2,3. The name of the column is Value.
  • For more info regarding Sequence function: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-sequence
  • For more info, please review the link – https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-with
    •  
    •  

Write the below code in the default property of the Number of Days DataCard Value.

Note: DataCardValue3(End Date), DataCardValue2(StartDate)

With (
    {
        // generate a one-column table of all dates between start date & end date
        varDateRange: ForAll(
            Sequence (DataCardValue3.SelectedDate - DataCardValue2.SelectedDate + 1),
            DataCardValue2.SelectedDate + Value - 1
        )
    },
    If(
        And (
            IsBlank(DataCardValue2.SelectedDate),
            IsBlank(DataCardValue3.SelectedDate)
        ),
        // show nothing if any date pickers are blank
        0,
        // include only dates Monday to Friday
        CountIf(
            varDateRange,
            Weekday (Value) in [2, 3, 4, 5, 6]
        )
    )
)

Setup A SharePoint List for Holiday Calendars

  • For the business day calculation, we need to exclude the holidays. So first we capture the number of holidays for the based on the region. For the capturing the holidays we create one list to store all holidays list called “US Holiday List” with the below listed columns.
    • Title (single-line text)
    • Holiday Day (date only)
Title Holiday Day
New Year’s Day 01-01-2022
Epiphany 01-06-2022
Valentine’s Day 2/14/2022
Presidents’ Day 2/21/2022
Employee Appreciation Day 03-04-2022

How to exclude holiday from the business days calculation in power apps

  • Now we have added the data source with power apps
  • We have already added the calculate business days excluding weekends, so we have enhanced the logic.
  • Now we can add the logic on the Default property of the Number of Days DatacardValue. If the holiday date is found within the single columns table being generated it does not get counted in the results.
  • Write the below code in the default property of the Number of Days DataCard Value.

Note: DataCardValue3(End Date), DataCardValue2(StartDate)

With (
    {
        // generate a one-column table of all dates between start date & end date
        varDateRange: ForAll(
            Sequence (DataCardValue3.SelectedDate - DataCardValue2.SelectedDate + 1),
            DataCardValue2.SelectedDate + Value - 1
        )
    },
    If (
        And (
            IsBlank(DataCardValue2.SelectedDate),
            IsBlank(DataCardValue3.SelectedDate)
        ),
        // show nothing if any date pickers are blank
        0,
        // include only dates Monday to Friday
        CountIf(
            varDateRange,
            Weekday (Value) in [2, 3, 4, 5, 6], Not (Value in 'US Holiday List'.HolidayDate)
        )
    )
)
  •  
  • For the validate start date & End date are not on Weekends or Holidays for check the

below Criteria.

  • The date is not a weekend day (Saturday, Sunday)
    • The date is not a holiday
    • The start date must be before the end date
    • Both a start date and an end date must be selected
    •  

For this validate we can add the border colour property of the Start Date picker.

Wire the below code on the start date datacard border colour.

Note: DataCardValue3(End Date), DataCardValue2(StartDate)

If (And (
     Or (
            Weekday (Self.SelectedDate) in [1,7],
            Self.SelectedDate in 'US Holiday List'.HolidayDate,
            Self.SelectedDate > DataCardValue3.SelectedDate
        ),
        ! IsBlank (DataCardValue2.SelectedDate),
        ! IsBlank(DataCardValue3.SelectedDate)),Red,Parent.BorderColor
)
  • Likewise, use the below code for End Date picker datacard BorderColor property.
If (And (
     Or (
            Weekday (Self.SelectedDate) in [1,7],
            Self.SelectedDate in 'US Holiday List'.HolidayDate,
            Self.SelectedDate 
  • For the below screenshot we add the Start Date >End Date so border show in red color.
  •  
  •  
  •  
  • Now you can add the button code as per your requirement.
  • As the below Screenshot the number of business day is 18 based on the StartDate and End Date.

PowerApps Premium Licensing

Power Apps premium license is required only if your application utilize some premium features! If not, Microsoft 365 license will be enough.

Using premium license, you can connect many of the premium connectors. Few examples are as below.

  • Microsoft Dataverse
  • SQL
  • Custom Connector
  • Azure App Service
  • Docusign

Premium License types in PowerApps

1. Per App Plan

2. Per User Plan

3. Pay As you go Plan

 

Per App Plan

Power Apps per app plan is actually a per-user-per-app.

So, you must buy one “per App” license for each single application user and user provided with this type of license can work with Power Apps premium feature with one app for one month. If licenses are assigned to the app, you can’t use it for other apps, because they were already assigned. You must buy more if you want to use this kind of license for different app.

User Environment 1 Per app licenses consumed
User 1 App A App B   2
User 2 App A App B Portal 2 3
User 3 App A     1
  • Sharing an app with a user consumes the per app capacity.
  • Each user is required to have a license to run an app.

E.g.

100 Users want to access 1 PowerApps with premium feature.

Cost: (Number of users*Per Apps License Cost) * No of Apps

Cost: (100*$5) *1= $500/Month

 

PowerApps Per User Plan

This plan is straightforward. By purchasing and assigning this plan you guarantee access to Power Apps premium features to one user. So, the name is accurate in this example. One license for one user.

One license cost $20 per month.

E.g.

100 Users want to access all PowerApps across tenant with premium feature.

Cost: (Number of users*Per Apps License Cost)

Cost: (100*$20) = $2000/Month

 

Pay As you go Plan

This plan is something different. It is assigned to the environment, not to a User. Pay-as-you-go plan, like Power Apps per User/App plans allows users to utilize premium feature of Power Apps, Power Automate and Dataverse.

Pay-as-you-go plan is assigned to the environment, so consequently it is assigned to every app hosted on this environment. It means that every activity on each application for each user without a license will count as usage, so it will be charged.

If you will assign pay-as-you-go plan to the environment and you will create an app utilizing premium features, you will be charged 10$ per each user using this app – per month. 1 application run by a user is enough to charge you 10$. Here is Microsoft statement from a documentation.

Microsoft calculate the cost of pay as you go plan as below.

 

Generate a PDF using PowerAutomate Method – 2

In previous blog, we discussed about Generating the PDF from Microsoft Flow with 2 approaches. The First one with HTML Template can be accessed from here Generate a PDF using PowerAutomate Method – 1

Lets start with the Second approach,

Part-2
Generate a PDF of SharePoint List Data with Word Template from Microsoft Flow

This is the second approach for generating the PDF from SharePoint List data that is using the predefined format as Template in SharePoint Document Library, then updated the file properties and created a template in OneDrive then converting that template to PDF and saving in SharePoint Document Library.

The approach goes like,

Step-1

Create a SharePoint Custom List named Conversion-to-PDF-from-Flow with necessary fields to enter the data, required to move to predefined PDF Format. Here I have taken following fields.

Create another SharePoint Document Library with name Test-PDF-Documents to store the generated PDF’s.

Please note, while creating multi-line columns, make sure the plain text is selected.

Step-2

The Word Template

Create a SharePoint Document Library named Test-PDF-Doc-Template. Create the same data fields created in the SharePoint List – Conversion-to-PDF-from-Flow.

We would create document template in the Library. We would create the same data fields in the library as we had created in the List named Conversion-to-PDF-from-Flow. Once we have created the same data fields, we would go to Library Settings > go to Advanced Setting > Edit Template.

In previous approach, we used tokens. In this approach we would be using the quick parts from Insert tab. We can access or add them like Insert > Quick Parts > Document Property > Use the data column which would be used to replace the data inserted in it.

One created the template would look like this,

Once created, save it in .docx format.

So next time when you would try to edit the template it would have to be saved in .docx format.

Step-3

Creating the flow

  • Create the Flow with the trigger – When an item is created of SharePoint connector. Select the Site collection address and List’s name.

Add an action – Get File Content of SharePoint connector. Select the Site collection address and the File from which the template would be taken and used to create the file.

  • Add an action – Create File of SharePoint connector. Select the Site collection address, folder path to the template saved, Create a File name as required and select the file content from dynamic content window from the previous action.
  • Add an action – Update File Properties, select the Site collection address, Library name, Select the ID as ItemID from previous action Create File action and select the data fields linked to each other.
  • Add an action – Get File Content of SharePoint connector. Select the Site Collection address, and the file identifier, set the file identifier as file identifier from the previous action.
  • Add an action – Create File of OneDrive connector. Select the Folder path to save the file, name of the file and the file content as file content from previous action from dynamic content.
  • Add an action – Convert File of SharePoint connector. Select the File as ID from the precious action.
  • Add an action – Create File of SharePoint connector. Select the Site collection address, folder path to save the file, name of the file with an extension .pdf and file content as File Content from previous action of Convert File.

Once the Flow is created, it would look like this,

Let’s enter data in our SharePoint Custom List Conversion to PDF from Flow,

The document that gets created in Library named Test-PDF-Doc-Template while the Flow runs would come up as,

The document that would be created inside the Library Test-PDF-Documents after the Flow runs would come up as,

The file content would come up like this,

Part – 1 Expand-Collapse rows in PowerApps Canvas App Gallery

I

n this blog post, I have shown the steps for creating the expand-collapse gallery control in Canvas App.

Now, let’s start building the gallery, for which we would have to create out list first and have the same loaded in a PowerApps App as a data source.

Step 1 – Create “Expand-Collapse Control” list with the following columns and their types.

Step 2 – Add entries in “Expand-Collapse Control” list

Step 3 – Create canvas app and name it “Expand-Collapse App”

  1. Add a new Blank screen
  2. From the controls section on the top in Insert tab, add a “Blank flexible height” gallery which would be our Parent Gallery
  3. And add a “Blank vertical” gallery in “Blank flexible height” gallery – which would be our Child Gallery
  • Parent Gallery
  • Child Gallery

Step 4 – Adding the data source to Gallery

In Parent Gallery add “Expand – Collapse Control” list data

For Child Gallery in “items” property add code – ThisItem

Step 5 – Add labels according list’s columns and add show data

Step 6 – Add code on all label’s “visible” property which are added in “Child Gallery”. Also, to have the Child Gallery show when button is clicked, we have to add code in Child Gallery’s on “Visible” property

“Visible” property – Switch(varShowId,0,false,ThisItem.ID,true)

Step 7 – Add down arrow icon and up arrow icon.

Then first write code on down arrow icon(Down arrow icon) it’s “OnSelect” property – If(varShowId=ThisItem.ID,Set(varShowId,0),Set(varShowId,ThisItem.ID))

And add code on visible property – If(Up arrow icon.Visible=true,false,true)

Step 8 – On  the down arrow icon and write code on it’s “OnSelect” property – If(varShowId=ThisItem.ID,Set(varShowId,0),Set(varShowId,ThisItem.ID))

And write code on it’s “Visible” property – Switch(varShowId,0,false,ThisItem.ID,true)

That’s all,

We have finally created the collapsible Gallery control in Power App.

Hope this helps!!

 

Thank you,
Jaydeep Patel

Generate a PDF using PowerAutomate Method – 1

R

ecently while working for one of the client’s requirements, in which they wanted to generate a PDF saved in SharePoint Document Library once the user submits a Form. The PDF had to be in a pre-defined format that they were using as Word Document.

This was achieved with 2 different approaches –

Generate a PDF of SharePoint List Data Through HTML Template from Microsoft Flow

In this approach we created a html of the document and upload as a Template, used the template in Flow to create html file in OneDrive and then converted the file to PDF and saving it in SharePoint Document Library.

Generate a PDF of SharePoint List Data with Word Template from Microsoft Flow

In this approach we used the predefined format as Template in SharePoint Document Library, then updated the file properties and created a template in OneDrive then converting that template to PDF and saving in SharePoint Document Library.

 

Part-1
Generate a PDF of SharePoint List Data Through HTML Template from Microsoft Flow

Step-1

Create a SharePoint Custom List named Conversion-to-PDF-from-Flow with necessary fields to enter the data, required to move to predefined PDF Format. Here I have taken following fields.

Create another SharePoint Document Library with name Test-PDF-Documents to store the generated PDF’s.

Please note, while creating multi-line columns, make sure the plain text is selected.

Step-2

The HTML Template

Create a html format of the data you want, here is the format I used, the structure used here contains {tokens} that would be used in Flow compose actions to perform text replacements.

This is a simple document, for creating more styled document, you can add CSS as per the requirements.

Create a SharePoint Document Library named Templates to store the template in html format.

Step-3

Creating the Flow

  • Create the flow with the trigger, when an item is created of SharePoint connector. Select the site collection address and List’s name.
  • Click on + sign or next step, add Get Item action of SharePoint connector. Select the Site Collection address and List’s name and select ID parameter from Dynamic content window from When an item is created section.
  • Add an action, Current time of Date Time connector. We would use the same in compose action while creating the file name.
  • Add an action, Get File content of SharePoint connector. Select the Site collection address and the File Template, in this case I created a Library named Templates, and Template is the name of the template, we would be using.
  • Add an action, Get File content of SharePoint connector. Select the Site collection address and the File Template, in this case I created a Library named Templates, and Template is the name of the template, we would be using
  • Similarly, we would add 2 compose actions to replace Assigned to and Comments section with the following expression respectively.
@{replace(outputs('Compose_-_Set_Title'),'{assignedto}',body('Get_item')?['AssignedTo']?['DisplayName'])}

@{replace(outputs('Compose_-_Set_Assigned_To'),'{comments}', body('Get_item')?['Comments'])}
  • Add another Compose action to set the file name. We can set the name as we want, here I have taken Name from the SharePoint list and Current time to differentiate the files.
  • Add an action, Create File of OneDrive for business connector. Select the Folder path, set the file name from the output of the File Name and add .html at its end, select the File Content from the output of action Compose- Set Comments.
  • Add an action, Convert File of OneDrive connector. Select the ID from the previous action of Create File.
  • Add an action Create File of SharePoint connector. Select the Site collection address, select the Folder path as the Library where you would like to store the file, set the File Name as the output of action Compose- File Name and add .pdf at its end, set the File Content as the File Content from Dynamic Content of previous action Convert File
  • Add an action to Delete the File created in OneDrive folder, Add Delete File of OneDrive for business connector. Select the ID as the ID that was used to create file from previous Create File action. Save the Flow.

The final look of flow would be like this,

Let’s enter data in our SharePoint Custom List Conversion to PDF from Flow,

The document that would be created inside the Library after the Flow runs would come up as,

The file content will come up like this,

Publish Power App to the Teams App Store

 

I

n this blog, I am performing the steps one should follow to publish your PowerApps to the Teams App Store.

 

Let’s get started- 

 

Step-1:

From the PowerApps portal, Click Apps in the app bar. 

 

Step-2: 

To the right of your app name, Click the menu then select Add to Teams. 

Step-3:

In the Add to Teams pane, click Add to Teams. 

Note: you may want to first click Edit details to add a short description, so your users know what‘s expected when using this app. You can also expand Advanced settings to add further information. For example, you can include a link to instructions if you‘d like. 

Step-4: 

Power Apps will open Teams. Your browser may request access to open in the desktop app. If you prefer that, allow it. If not, click Cancel then click Use the web app instead.

Step-5: 

Once Teams opens to the app details page, click Add. 

Step-6: 

The app opens from the Teams app bar. 

Step-7: 

Right-click the app icon to pin it to stay.

PowerApps – Role Based Security Using SharePoint Group

W

hile creating a PowerApps app, we needed to add a button that would be visible only for a particular set of users who were present in a specific group in SharePoint. This was accomplished with the help of Flow.

We would check with the help of Flow that the user that is trying to access the App, is present in the group or not. If yes, the button is available and if not, the button won’t be.

The approach goes like,

Step-1

Create a SharePoint Security Group and add the users who would have the access to the button in PowerApps App.

And enable the access to view the members of the Group to Everyone, so that when the user tries to login, not all users would be in the group.

Step-2

Creating the Flow

  • Create the Flow, with the trigger PowerApps of PowerApps connector.
  • Add an action, Initialize variable of Variables connector. Set the name as isAdministrator to store a Boolean value.
  • Add another Initialize variable of Variables connector. Set the name as UserGroupInfo to store a Boolean value.
  • Add an action, Send an HTTP request to SharePoint of SharePoint connector.

Site Address – Select the site address where the security group is created
Method – GET
Uri – api/web/sitegroups/getByName(‘SharePoint Group’)/Users?$filter=Email eq ‘’
Replace the SharePoint Group with the name of the group created in Step-1. Here I had created the group ‘Line Manager’.
Put the cursor pointer in between the single quotes and select the option from PowerApps, SendanHTTPrequesttoSharePoint_Uri from dynamic content window.

  • Add an action, Set Variable of Variable connector. Select the variable UserGroupInfo in Name and value as Body from Send an HTTP request to SharePoint from dynamic content.
  • Add an action, Condition of Control Connector. Set the conditional value as variable UserGroupInfo and select the condition is not equal to and in value to be compared as ‘[]’.Inside the if yes and if no options,

For option if yes, add an action Set Variable of Variable connector. Select the variable isAdministrator and set the value as true,

For option if no, add an action Set Variable of Variable connector. Select the variable isAdministrator and set the value as false.

  • Add an action, Respond to PowerApps of PowerApps connector. Select the text option for the output. Set the variable as isAdminUser and the value as isAdministrator from the Dynamic content.

The final look of the flow would be like this,

Step-3

Implementing the Flow with PowerApps App

After the flow is ready, lets configure the same with the App to test it.

On the first screen that would be visible when you run the App, on its OnVisible Property, set the variables as below

First, we take the variable isAdmin and set it as false.

Secondly, we would check with the flow to set the variable UserGroupInfo as the flow’s outcome.

On the button’s visible property, set it as If(isAdmin, true). SO that if the user is in the SharePoint Group the button would be visible else it would not.

So when a user is inside the SharePoint Group, the screen would display the button,

And when the user is not,