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.

How to export information to a CSV (Comma-separated values) file in SharePoint Framework (SPFx)?

Introduction:

We recently implemented a customized Learning Management System (LMS) in SharePoint Online using SharePoint Framework (SPFx) for a Postal and Parcel company based out of Melbourne, Victoria, Australia. We also implemented a simple tabular format report in SPFx that will allow the admin user to see which user has completed which training and which training is pending. The requirement was also to allow admin users to export this tabular report to a CSV file. In this blog, we will learn about exporting data/information to a CSV file in SharePoint Framework (SPFx). 

We will be using the below npm packages in our SPFx solution.

Office-UI-Fabric-React:

  • The “Office-UI-Fabric-React” package will be used to develop different user controls.
  • This package gets installed automatically when we create an SPFx solution.

React-CSV:

  • The “React-CSV” package will be used to generate a CSV file.
  • We will run the below NPM command in CMD (Command Prompt) to install the “React-CSV” package.

 npm install react-csv –save;  


Below are the steps to convert simple data into CSV format:

Step 1: Import the “CSVLink” class from the “React-CSV” and the “CommandBarButton” class from the “Office-UI-Fabric-React”. 

 import { CSVLink } from "react-csv";  
 import { CommandBarButton } from 'office-ui-fabric-react';  


Step2: We will be using the “CSVLink” class and “CommandBarButton” as shown below.

 <CSVLink data={csvList} filename={'UserInformationReport.csv'}>  
       <CommandBarButton className={styles.ExportButton} iconProps={{ iconName: 'ExcelLogoInverse' }} text='' />  
  </CSVLink>  

  • This will create a button to export information into a CSV file.

Below are the “CSVLink” class properties:

  • Data: This is a required property and we need to pass the values as an array.
  • Filename: We have to provide the filename for the CSV file to be exported.
  • Headers: This will provide a custom header for our CSV file and also this property is used to define the order of the CSV fields.

We have provided the below array data in the data property.
 Let csvList = [{"Outlet":"Outlet 1","Work Center Code":"123456","Email Address":"user1@tenant.com.au","Name":"Test User 1","Completed Trainings":"Training 1, Training 2, Training 3","Pending Trainings":"Training 4, Training 5","Completion Percentage":60,"First Assessment Date":"11/6/2020","Last Assessment Date":"11/26/2020"},  
 {"Outlet":"Outlet 2","Work Center Code":"456789","Email Address":"user2@tenant.com.au","Name":"Test User 2","Completed Trainings":"Training 1, Training 2","Pending Trainings":"Training 3, Training 4, Training 5","Completion Percentage":40,"First Assessment Date":"11/3/2020","Last Assessment Date":"12/2/2020"},  
 {"Outlet":"Outlet 2","Work Center Code":"456789","Email Address":"user3@tenant.com.au","Name":"Test User 3","Completed Trainings":"Training 1, Training 2, Training 3, Training 4","Pending Trainings":"Training 5","Completion Percentage":80,"First Assessment Date":"11/6/2020","Last Assessment Date":"11/26/2020"}];  

Step 3: Below is the CSV button for exporting the information to a CSV file.


  • By clicking on this button, a CSV file "UserInformationReport.csv" will be generated with the above data.

CONCLUSION:

This is how we can export information to a CSV (Comma-separated values) file in SharePoint Framework (SPFx). Hope this helps you, good day!

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

January 12, 2021

Allow users to upload only specific extension files in Power Apps Attachment control

Introduction:

In this blog, we will learn how to allow users to upload only specific extension files in Power Apps Form Attachment control. The example here we have carried in this blog is to allow users to upload only the ".pdf" extension files.

Resolution:

Below are the steps we are going to work on here!

1.     Set restriction on uploading other extension files in Attachment control and notify the user when they upload any extension file other than ".pdf".

2.     Restrict the user from saving until resolving file errors.

Step 1: Set restriction on uploading other extension files in Attachment control

Place the below code at OnAddFile property of the Attachment control:

 If(  
   CountRows(  
     Filter(  
       RenameColumns(  
         DataCardValue4.Attachments,  
         "Name",  
         "NewName"  
       ),  
       Last(  
         Split(  
           NewName,  
           "."  
         )  
       ).Result <> "pdf"  
     )  
   ) > 0,  
   Notify(  
     "Only PDF files can be attached",  
     NotificationType.Error  
   );  
   ,  
   SubmitForm(Form1);  
   ResetForm(Form1);  
   EditForm(Form1);  
   )  

After placing this, check by adding a different extension file in the attachment control. You will be able to see this type of error at the top of the app.


Now as we have set the restriction message, let’s restrict the user from saving the form until all the attachments in the control are ".pdf".

Step2: Restrict user from saving until resolving file errors

Place the below code in the OnSelect property of the save button or in the OnSave property of SharePointIntegration:

  If(  
   CountRows(  
     Filter(  
       RenameColumns(  
         DataCardValue4.Attachments,  
         "Name",  
         "NewName"  
       ),  
       Last(  
         Split(  
           NewName,  
           "."  
         )  
       ).Result <> "pdf"  
     )  
   ) > 0,  
   Notify(  
     "Only PDF files can be attached",  
     NotificationType.Error  
   );  
   ,  
   SubmitForm(Form1);  
   ResetForm(Form1);  
   EditForm(Form1);  
   )  

Now add a different file extension in the control and click on save. It will show the below error and won’t let the user save the item.

Conclusion

This is how we can restrict users to upload only ".pdf" extension files in the Power Apps - Form Attachment Control.

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

January 7, 2021

[Issue Resolved]: Default value of custom property in SPFx web part Property pane is not showing while running in Workbench Mode

Issue:

When we set the default value of custom property in the SPFx web part, it is not getting displayed in the Property pane while code is running in the Workbench mode (debug mode).

As shown below, We've set the default value of "SharePoint Training Custom List Name" custom property as "Training", but it is not displaying in the property pane while code is running mode.





Solution:

When we do any changes in “webpart.manifest” file, it will not reflect directly in the web part if it is in running mode.

To resolve this issue, please follow the below steps:

  • Stop the project execution if it is in running mode.
  • Re-build the project solution and re-run the project.
  • To rebuild the project please run the below-mentioned command respectively:
    • gulp clean
    • gulp build
    • gulp serve
  • Navigate to the SharePoint Workbench. Remove the existing web part from the page and add it again to reflect the changes.
  • Now, you will be able to see the default value of the custom property which we added for the "SharePoint Training Custom List Name" property in the property pane.






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

New Teams Meeting Experience with Large Gallery and Together Mode

Overview:

Sometimes, in Teams meeting, there’s a possibility that a large number of people joined the meeting with a camera turned on. At that time, it’s difficult to see everyone’s face on the width of a screen. So, what are options or alternatives? Let’s discuss this during this article! We will be discussing two new options which recently launched – “Together Mode” and “Large Gallery”. 

Prerequisite:

First, we need to enable New Meeting Experience for Teams.
  1. From the upper right corner of Teams, click on your profile icon.
  2. Click on Settings.
  3. From “General” make sure “Turn on new meeting experience (New meetings and calls will open in separate windows. Requires restarting Teams.)” option is enabled.
  4. Restart your Microsoft Teams.

With the new Microsoft Teams experience, now we have the following options available for Microsoft Teams experience. 
  • Gallery
  • Large Gallery (Preview)
  • Together Mode (Preview)

Gallery View:

This is the default view when anyone in Teams joins a call. In Gallery view, we can see 9 feeds at a time on the screen. Please see the below screenshot.

Large Gallery:

If the participant feed is 10 or more, this option is available for you. With a large Gallery, we can see the 49 participants at once. 

Together Mode:

  • Instead of seeing all the meeting participants in a square size of blocks, “Together Mode” provides a virtual space where we can see all team members together. This provides the same feel of face to face meeting experience. Recently due to the COVID pandemic, we celebrated our virtual Diwali on Teams. Here, you can see the experience looks awesome! 
  • We need at least 5 participants to activate “Together Mode”. With “Together Mode” we can see a Maximum of 49 people on a feed. 

Conclusion:

This is how we can utilize the “Together Mode” and “Large Gallery” options for a better team meeting experience. 

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