After reading this article, you will learn how to use ShortPoint to pass dynamic parameters to your PowerApps application.
Prerequisites:
1. You already added the PowerApps ShortPoint Element on your Page. Please follow this article to find out how to add your first PowerApps application to SharePoint.
2. You are logged in with your ShortPoint Designer Account.
STEP 1: Go to the Advanced Tab of Your Page Builder PowerApps Element
Scroll down and identify the Send Custom Parameters function box.
STEP 2: Compose the dynamic parameters
In the function box, return dynamic parameters following the example:
return 'userName=' + _spPageContextInfo.userLoginName + '&siteUrl=' + _spPageContextInfo.webAbsoluteUrl + 'appMode=view'
In the example, we send to the PowerApps application two dynamic parameters (userName and siteUrl) and one static parameter (appMode).
_spPageContextInfo is a SharePoint global variable containing context information regarding the current logged in user, current site, tenant information, etc. You can also use other custom javascript variables to pass dynamic parameters to your PowerApps applications.
An example list with the complete information stored in the _spPageContextInfo variable can be found below:
CorrelationId : "b215479e-f056-5000-11a1-ec000000000010" DesignPackageId : "00000000-0000-0000-0000-000000000000" PreviewFeaturesEnabled: true PublishingFeatureOn : false ReycleBinItemCount : -1 aadInstanceUrl : "https://login.windows.net" aadTenantId : "96d8e75d--14a031e2320f" aadUserId : "e7d71f70-13e9-0000-0000-86d1269cd536" alertsEnabled : true allowSilverlightPrompt : "True" blockDownloadsExperienceEnabled : false canUserCreateMicrosoftForm : true canUserCreateVisioDrawing : true cdnPrefix : "static.sharepointonline.com/bld" crossDomainPhotosEnabled : true currentCultureLCID : 1033 currentCultureName : "en-US" currentLanguage : 1033 currentUICultureName : "en-US" departmentId : null disableAppViews : false disableFlows : false env : "prod" farmLabel : "US_9_Content" fid : 16190 formDigestTimeoutSeconds : 1800 groupColor : "#188387" groupHasHomepage : true groupHasQuickLaunchConversationsLink : false groupId : "c771d35a-fee4-4447-9c0a-6c0b199d00fc" groupType : "Private" guestsEnabled : false hasManageWebPermissions : true hasPendingWebTemplateExtension : false hideSyncButtonOnODB : false hubSiteId : null idleSessionSignOutEnabled : false isAnonymousGuestUser : false isAppWeb : false isEmailAuthenticationGuestUser : false isExternalGuestUser : false isHubSite : false isMultiGeoTenant : false isNoScriptEnabled : true isSPO : true isSiteAdmin : true isTenantDevSite : false isWebWelcomePage : false layoutsUrl: "_layouts/15" listBaseTemplate : 100 listId : "{7069a902-4347-000-8a03-00fceecfdc70}" listPermsMask : {High: 2147483647, Low: 4294705151} listTitle : "Property Locations" listUrl : "/sites/DemoModernTeamSite/Lists/Property Locations" maximumFileSize : 15360 msGraphEndpointUrl : "graph.microsoft.com" navigationInfo : {quickLaunch: Array(14), topNav: Array(2)} nid : 107 openInClient : false pageItemId : -1 pageListId : "{7069a902-0000-4000-8a03-21fceecfdc70}" pagePermsMask : null pagePersonalizationScope : 1 preferUserTimeZone : false readOnlyState : null serverRedirectedUrl : null serverRequestPath : "/sites/DemoModernTeamSite/Lists/Property Locations/AllItems.aspx" serverTime : "2018-02-04T04:58:48.0656761Z" showNGSCDialogForSyncOnODB : false howNGSCDialogForSyncOnTS : true siteAbsoluteUrl : "https://constoso.sharepoint.com/sites/DemoModernTeamSite" siteClassification : "" siteClientTag : "0$$16.0.7324.1203" siteColor : "#188387" siteId : "{1c2e6438-80d2-40cc-9bc5-5aa657c00000}" sitePagesEnabled : true siteServerRelativeUrl : "/sites/DemoModernTeamSite" siteSubscriptionId : "0f6d0000-f22c-47d7-a17f-cd78e6b74a54" supportPercentStorePath : true supportPoundStorePath : true systemUserKey : "i:0h.f|membership|10030000000003d@live.com" tenantAppVersion : "3704586950" themeCacheToken : "/sites/DemoModernTeamSite:/sites/DemoModernTeamSite/_catalogs/theme/Themed/6FE0689A:9:16.0.7324.1203" themedCssFolderUrl : "/sites/DemoModernTeamSite/_catalogs/theme/Themed/6FE0689A" themedImageFileNames : {spcommon.png: "spcommon-B35BB0A9.themedpng?ctag=9", ellipsis.11x11x32.png: "ellipsis.11x11x32-2F01F47D.themedpng?ctag=9", O365BrandSuite.95x30x32.png: "O365BrandSuite.95x30x32-C212E2FD.themedpng?ctag=9", socialcommon.png: "socialcommon-6F3394A9.themedpng?ctag=9", spnav.png: "spnav-230C537D.themedpng?ctag=9", …} userDisplayName : "Rajesh Sitaraman" userEmail : "rajesh.sitaraman@contoso.com" userFirstDayOfWeek : null userId : 3 userLoginName : "rajesh.sitaraman@contoso.com" userTime24 : false userTimeZoneData : null viewId : "{7edde8c2-5458-42b4-0000-883094b3837e}" viewOnlyExperienceEnabled : false webAbsoluteUrl : "https://contoso.sharepoint.com/sites/DemoModernTeamSite" webDescription : "Demo Modern Team Site" webFirstDayOfWeek : 0 webId : "{8985f800-0000-42f2-899a-abb9f24251e3}" webLanguage : 1033 webLogoUrl : "/sites/DemoModernTeamSite/_api/GroupService/GetGroupImage? id='8c1914df-0000-4088-a812-96183d42ae27'&hash=636533140690897999" webPermMasks : {High: 2147483647, Low: 4294705151} webServerRelativeUrl : "/sites/DemoModernTeamSite" webTemplate : "64" webTemplateConfiguration : "GROUP#0" webTime24 : false webTimeZoneData : {Description: "(UTC-08:00) Pacific Time (US and Canada)", Bias: 480, Id: 13, DaylightBias: -60, DaylightDate: {…}, …} webTitle : "Demo Modern TeamSite" webUIVersion : 15
That's it!
Related articles:
- PowerApps Orientation and custom sizes
- Embed PowerApps on SharePoint On-Premises and SharePoint Online (cross-tenant)