September 29, 2022

Get Members from the Security Group in Power Apps

We often come across a requirement wherein we need to fetch the information from the Security Group and need to display within Power Apps for Business Logic implementation.

Example:
Below is one of the Security Group created in Microsoft 365. Here, there are two members added to that Security Group.

In Power Apps, we need information about those two users.

Step 1: Open Power Apps Canvas App. First, we need to add Office 365 Groups Connector. For that, 
  1. Go to View Menu, and select Data sources.

  2. Search for “Office 365 Groups”. Select the highlighted one and add a connector to the App.

  3. Once the Connector is added, this will look like this.

Step 2:
  1. Open Power Apps screen and add a button.
  2. Write the following line of code for “On Select” event of the button.
     ClearCollect(MembersfromSG,Office365Groups.ListGroupMembers("GroupID").value)  
  3. Here, MembersfromSG is the Name of the collection. Office365Groups.ListGroupMembers(“Group ID”) returns the information about all the members of that security group.

How can we find that Group ID for the Security Group?
  1. Open Azure Portal and search for Groups. This will open the following screen.
  2. Select your security group for more information.
  3. Copy Object Id. This is the Group ID. We can use this Group ID in the below formula. The formula will look like this.
 ClearCollect(MembersfromSG,Office365Groups.ListGroupMembers("xxxxxxxx-1xxb-4x4b-xxxxxx").value)  

Step 3: Now, add Gallery Control and add Collection as a data source. This will show users in the Gallery.

Step 4: Now, let’s run the solution. This will show, User’s Display Name and User Principal Name.
You can check more properties of members returned by this collection from the executed collection.

Conclusion:
This is how we can get the Member Information using Office 365 Groups Connector in Power Apps.

If you have any questions you can reach out our SharePoint Consulting team here.

September 15, 2022

Filter Records based on Date and Time Condition in Power Apps

Overview:

Consider a scenario, where you are moving your Power Apps to the production environment and we only want to show records after our Production Launch!

Let’s say, Production Live happened at 01:00 PM then we need to show records created after 01:00 PM on that day. So, how can we achieve this? 

Solution:

We need to use the following Power Fx formula to achieve this!
  • DateValue
  • Time function with Hour, Minute, and Second

Consider the following example:
Below is the screenshot for List Items. We need to show records that are created only after “07/26/2021 01:00:00 PM”.
 

Go to your Power Apps and Add the following line of code to your Items Property of the Gallery.
 Filter(  
   Leaves,  
   (DateValue(  
     Text(  
       Created,  
       "[$-en-US]mm/dd/yyyy"  
     )  
   ) + Time(  
     Hour(Created),  
     Minute(Created),  
     Second(Created)  
   )) > (DateValue("07/26/2021") + Time(  
     Value(13),  
     0,  
     0  
   ))  
 )  

Here, we are comparing if the "Created" value from SharePoint List is greater than “07/26/2021 01:00:00 PM”.

As a result, we are getting the following outcome!
 

Conclusion:

Hope, this trick is helpful to you! Happy Power Apping!!

If you have any questions you can reach out our SharePoint Consulting team here.

September 8, 2022

How can we Pad 0 to Integer Values in Power BI?

Overview:

Sometimes we have a requirement, where we need to Pad “0” to our numeric value. There are multiple ways to implement this. But we will go with the simplest and easiest one! So, let’s get started!

Step 1:

This is our Sample Data Source, where we have Project ID, Project Name, and Hours column.

Now, we want to pad “0” before our Project ID column and need the end outcome like the following. So, how can we achieve this?

Step 2:

 - Open Model View of Power BI Desktop and select the “Project ID” column.
 - From Format, select “Custom”.
 - Under Custom Format provide, format as “00#” – This will suggest, from a 3-digit number, it will pad leading digits with “0”. 

Example: If the number is 9, it will show as “009”. If the number is 19 then it will show as “019”. This will show us the end outcome as below screen!

Conclusion:

This is how we can simply pad leading “0” before the number in Power BI. Isn’t that cool? Happy Reporting!

If you have any questions you can reach out our SharePoint Consulting team here.

September 1, 2022

[Issue Resolved]: You are not authorized to send mail on behalf of the specified sending account.

Introduction

Recently, while working on a Power Automate Flow, we came across a requirement to send an email from another user. We used the “Send an email (V2)” action.  In this action by clicking on “Show advanced options” we configured the From (Send as) field.
But the flow run failed. The error message below was displayed:

"You are not authorized to send mail on behalf of the specified sending account."

This means to use this option we are required to have "Send as" or "Send on behalf" permissions granted to the account using which the “Send an email V2” action is configured. 

In this blog, we will learn how to set up required mailbox permissions in order to use From (Send as) option.

Solution:

Step 1: Go to the Admin Center.
Step 2: Select Users > Active Users 

Step 3: Select the user for which you want to manage the mailbox permissions.
Step 4: A popup will appear and on the Mail tab you can see 3 different permissions under Mailbox permissions. 
  • Read and manage permissions: This permission allows the assigned user mailbox to read as well as manage emails in the user mailbox on which the permission is assigned. 
  • Send as permissions: This permission allows a user to send emails from the mailbox as the mailbox owner.
  • Send on behalf permissions: This permission allows the assigned user to send emails on behalf of the owner.

Step 5: To configure the permission, click on the respective permission and select Add permissions. In this case we wanted to grant “Send as” permission. 

Step 6: Now select the user (Flow Creator) you want to grant permission to. 
Step 7: Select Add.

Note: Once you've set up the permissions, it can take up to 60 minutes for the changes to be in effect. 

Conclusion:

So this is how you can send emails on behalf of another user and send emails as if they were sent from that mailbox.

 If you have any questions you can reach out our SharePoint Consulting team here.