January 28, 2021

All you should know Condition and Switch Condition in Power Automate (MS Flow)

Introduction: 

We implemented the automated process using Power Automate (MS Flow) for a Postal and Parcel company based out of Melbourne, Victoria, Australia. The automated process was lengthy in terms of implementation that required many if/else conditions and routes. In this blog, we will understand the difference between Condition and Switch control in Power Automate (MS Flow), the benefits of using it, and also discuss its limitations.

So, let’s first talk about Limitations for Condition and Switch Actions:

  • In Power Automate, if we use Condition Action, then we can add max. 8 nested steps and 500 actions per flow.
  • In Power Automate, if we use Switch Action, then we can add max. 25 nested steps and 500 actions per flow.

How to overcome the limitation for Conditional Statements?

Now, let’s talk about how we can overcome this limitation? We came across a scenario wherein we reached the 8th nested level with a conditional statement, then what can we do?

To overcome such a scenario, we can implement “Child Flow”. To, implement the concept of the child flow, we need to follow the below steps. The detailed information with a real-life scenario for creating a child flow can be referred to from this Blog Post. Below is the summary for the same.

  1. Create a Flow Solution. (To create a child flow, we must have to create a solution file.)
  2. Create a Child Flow
  3. Call Child flow from Parent Flow.

How to overcome the limitation for Switch Statement?

  1. To overcome this limitation you can add another switch case in default options and this way you can add another 25 cases.
  2. The default will execute if there is no match found.

Comparison between If and Switch.

If Conditions

  • Easy to Understand
  • Not practical if we have a lot of conditions.
  • Hard to visualize on the screen if we have more conditions.
  • There is a limit of 8 nested conditions (as of the writing of this post). 

Switch

  • Easy to setup.
  • Easy to visualize on the screen
  • Switch Case action only accepts string and integer when it compares values. So in case you have a date field or other column types, you would need to first initialize a variable and set it to be either a String or an Integer.
  • Cannot compare against Range.

Conclusion:

Hope, this helps to identify the limitations, solution, and comparison between Condition and Switch Action in Power Automate.   

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

How to register an App only Principal in SharePoint Online?

Overview:

We implemented the Delivery Schedule application in .Net Core for a Seattle, Washington-based construction firm. The information on Delivery Sites was available in SharePoint Online, we had to query this information using REST API from SharePoint Online and display the same in the .Net Core application.

Now, to call REST API from the .Net Core application, we need to use Client ID & Client Secret (app-only authentication) as per best practices. To generate Client ID and Client Secret, we need to register the SharePoint App. In this article, we will check the registration steps for the SharePoint App. So, now let’s get started!
  1. Access following URL to open App Registration Page.
    https://<<Site Collection URL>>/_layouts/15/appregnew.aspx 
  2. This will open following screen. 
  3. Click on “Generate” for Client ID and Client Secret. 
  4. Enter the Title, App Domain and Redirect URL.
    1. Title = BRiteApp (a meaningful name)
    2. App Domain = www.localhost.com
    3. Redirect URL = https://localhost.com 
  5. Click on Create.
  6. This will give you a summary of the App you created. Copy this information for future reference.
  7. Now, access the following URL.
    https://<<Site Collection URL>>/_layouts/15/appinv.aspx 
  8. This will open the following screen.
  9. Enter the same Client ID in the App ID field that we registered in Step 3 and click on Lookup. This will auto-populate other information.
  10. Now, in “Permission Request XML" we need to provide the XML with the desired permission level information. Below is the example XML that grants Site Collection level Full Control permission to the app. For more details on the permission request options, please visit this article from Microsoft.
     <AppPermissionRequests AllowAppOnlyPolicy="true">  
     <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />  
     </AppPermissionRequests>  
    

  11. Click on Create.
  12. Click on the “Trust it” button.

Conclusion:

This is how we register our App in SharePoint Online. The registered app (Client ID & Client Secret) can be used to call the SharePoint REST APIs from the other applications.

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

January 21, 2021

Implement Search for a Specific Column of Document Library in SharePoint Online

Overview

We at Binary Republik recently implemented the intranet solution for an Engineering & Construction company having headquarters in Boston, Massachusetts, United States. Implementing the tailored search for SharePoint Online - Modern Sites was also the part of requirements. The main purpose of the custom search implementation was to avail the results from a specific Document Library that will target the query on a specific column only.

Example

Let’s consider an example of one of the Document Libraries on our SharePoint site. Let’s say if we have a custom property for our document and when we search the document with that property it should find the document with its value. We want to implement a custom search for a specific document library column. Then how can we implement this?

So, now let’s check the overall procedure.

1.     Create custom properties for the column we wish to configure search.

2.     Go to site setting of the site.

From Site Collection Administration, go to Search Schema. We will be able to see all the manage properties of the site.

URL: https://yourtenant.sharepoint.com/sites/SiteName/_layouts/15/listmanagedproperties.aspx?level=sitecol

3.     To enable column search, we need to create a new custom property.

4.     Select New Managed Property.

5.     Give Name, Description (optional), and Type for the property.

6.    Check the checkbox for Searchable and also for Queryable. This is used the enable the column searches and enable the query for that column.

 7. Check the checkbox for Retrievable for retrieving the column in search call. If we need multiple values from this column, we can check the checkbox "Allow multiple values".


8.  Set the Alias to this property. We can also search based on this alias name instead of the property name.


9. We have to map this managed property with the Crawled Property (the column created in the Document Library should appear in the Crawled Properties). Click on "Add a Mapping".

 

10.  After that search the column name and click on the "Find" button. We are able to see all properties related to the column name, select the appropriate one and click "OK".

11.  Once we add the property, we will be able to see on the below screen.

So, this is how we can configure, managed property for a SharePoint - Document Library column.

Important Notes

·       If we want to implement search on multiple columns, then we need to repeat steps 1 to 11 for each property.

·       After creating custom properties that’s column will be searchable. This will take around 24 hours to crawl this column.

Usability of the Property

E.g.: We need to search "02265" cell phone number. So, we add this number with 'querytext' and we also use 'selectproperties' to select our "Cell Phone". It will search the cell phone number and as result, it will show in cell phone column value.

We can use the following syntax to search in a different manner. We can integrate the same Search API in the SPFx webparts or custom solutions to be implemented.

Conclusion

This is how we can configure the search to target the specific column of SharePoint Document Library!

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