Power Apps Host Object - Get Web Browser And O/S Details
Power Apps Host Object – Get Web Browser And O/S Details Posted by - Matthew Devaney on - May 14, 2023 14 Comments The Power Apps host object allows us to ge...
- Published
- Reading time
- 4 min read
Before you start
Is this guide for you?
- Best entry point
- Power Apps
- Time investment
- 4 min read
Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/power-apps-host-object-get-web-browser-and-o-s-details/. Author: Matthew Devaney.
Power Apps Host Object – Get Web Browser And O/S Details Posted by - Matthew Devaney on - May 14, 2023 14 Comments
The Power Apps host object allows us to get a session ID, the operating system, the user-agent or the tenant ID. It helps us understand the current hardware and environment the app is running in. This is very useful information to have when diagnosing Power Apps errors . In this article I will show you how to use the Power Apps host object. Table of Contents Introduction: The Report A Bug Screen Setup The SharePoint List Create A New Bug Report Screen Determine The BrowserUserAgent Check The Operating System Get-The-Power-Apps-Session-ID Obtain The Tenant ID
Submit The Bug Report To The SharePoint List Introduction: The Report A Bug Screen
Users of an app can go to the “Report An App Bug” screen to report an issue to the developer. The bug report includes details about the browser user agent, the operating system, the Power Apps session ID and the tenant ID. Setup The SharePoint List
Create a new SharePoint list with the following columns: BugDescription (multiple lines of text) BrowserUserAgent (single line text) OS (single line text) SessionID (single line text) TenantID (single line text) Create A New Bug Report Screen
Open Power Apps Studio and create a new canvas app from blank. Add rectangle to the top of the screen to make a titlebar. Add a label with the text “Report An App Bug” and also insert a bug icon.
Insert a new label with the words Tell Us What Went Wrong and a text input to capture a description of the bug. Determine The BrowserUserAgent
The browser user agent contains information about the web browser being used to run the app. We can use this User Agent parsing tool to understand what the text string means.
Add a bold label with the words BrowserUserAgent to the app and another label where the value will be shown.
Use this code in the Text property of the label the determine BrowserUserAgent. Host .BrowserUserAgent Code language: CSS ( css ) Check The Operating System
Power Apps can be run on many different operating systems including Windows, iOS, Android, and more. It is valuable to know the operating system because Power Apps can have different behavior on each one. To find which operating system is in use add a bold label with the title OS and then insert another label below it to show the value.
Write this code in the Text property of the label to show the operating system. Host .OSType Code language: CSS ( css ) Get The Power Apps Session ID
The Power Apps session ID is useful when reporting errors because it can be passed to Microsoft in a help ticket. Microsoft has the ability to view telemetry and see exactly what went wrong.
Place a bold label with the text Session ID onto the screen and create another label below it to store the value.
Use this code in the Text property of the label to get the Power Apps Session ID. Host .SessionID Code language: CSS ( css ) Obtain The Tenant ID
The final piece of information we can grab from the Host object is the tenant id where the app is located. Add a bold label to the screen with the text Tenant ID and create another label below it to store the value.
Write this code in the Text property of the label to display the Session ID value. Host .TenantID Code language: CSS ( css )
Submit The Bug Report To The SharePoint List
Once the user has written the bug report the they press a submit button to write the form data to the SharePoint list. Go to the Power Apps Data menu and add the Bug Reports SharePoint list.
Insert a new button at the bottom of the screen with the text “Submit”.
Then use this code in the OnSelect property of the button to submit the bug report. The app will display a success message upon submission or an error message if there is some problem. If( IsError( Patch(
'Bug Reports' , Defaults( 'Bug Reports' ), {
IssueDescription : txt_IssueDescription,
BrowserUserAgent : lbl_BrowserUserAgentValue, OperatingSystem : lbl_OSValue, SessionID : lbl_SessionIDValue,
TenantID : lbl_TenantIDValue } ) ), Notify( "Error: Bug could not be reported to the app developer" ), Notify( "Success: Bug was reported to the app developer" ) ) Code language: JavaScript ( javascript ) Did You Enjoy This Article? 😺
Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?
If you have any questions or feedback about Power Apps Host Object – Get Web Browser And O/S Details please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney M365 Copilot Power Apps
How To Create Copilot Custom UI Widgets In Power Apps
Tagged
Power Apps
Have a Microsoft 365 topic idea?
Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.
Keep learning Microsoft 365
Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.
Continue learning
Related tutorials
Related questions
Related comparisons
Next action