• Create an Azure Function App that connects to SharePoint Online

    How to create an Azure Function App that connects to SharePoint Online using an App Registration with a self-signed certificate. Then we call the Azure function from Power Automate.

    In this post, we will:

    • Create an Azure App Registration with a self-signed certificate and configure access to a single SharePoint site collection.
    • Create and configure an Azure Function App with some Application Settings.
    • Create and configure an Azure Function App in Visual Studio that uses the certificate we created to debug locally.
    • Publish the Azure Function App code from Visual Studio.
    • Test the Azure Function App from the Azure Portal. - Call the Azure Function App from Power Automate.

    Prerequisites

    Save your work

    I recommend creating a file in your favorite note application that will be used to save all of the Ids, passwords, etc., collected along the way. I also recommend storing this information permanently in a Password Manager or secure location.

    Here is an example of the notes I captured during the process. We will fill in these values as we go.

    • SharePointSiteUrl: {Your site collection URL}
    • Application (client) ID: {Your application ID}
    • Directory (tenant) ID: {Your Azure Tenant ID}
    • Certificate Common Name: {The common name you give to the certificate}
    • Certificate Start Date: {The start date you added to the certificate}
    • Certificate End Date: {The end date you added to the certificate}
    • Certificate Password: {The password you added to the certificate}
    • Certificate Thumbprint: {The thumbnail for the certificate}
    • Function URL: {The URL portion of your Function URL}
    • Function URL Code: {The code portion of your Function URL}

    SharePoint

    I won’t go into details about setting up the SharePoint site. You may already have an existing site you want to use. This article will need a SharePoint List on a single site collection.

    Pasted image 20221207104748

    Create an Azure App Registration

    The Azure App Registration allows the Function App to talk to SharePoint without an actual user account. It must be created in the Azure AD used by your Office 365/SharePoint environment.

    Create the App Registration

    • Log into your Azure AD.
    • Open App Registrations from the left navigation
    • Click New Registration.
    • Give it a unique and descriptive name.
    • Leave the defaults.
    • Click Create.
    • Copy the Application (client) ID and Directory (tenant) ID into your notes.

    Add a Certificate

    Next, we want to secure our App Registration using a self-signed certificate. The certificate is created using PowerShell. It will create two files, the .cer and .pfx files. The .cer file is added to your App Registration, and the .pfx is added to your Function App.

    • Open PowerShell on your local machine as an administrator.
    • Run the PowerShell found in this [[Create a self-signed certificate using PowerShell|post]].
    • It will ask you for a few things. Copy your values into your notes.
      • Common Name: Give the certificate any name you want.
      • Start Date: The date the certificate will become effective.
      • End Date: The date the certificate will expire.
      • Password: Enter a unique password.

    Pasted image 20221207090527

    • After running the PowerShell, two files will be saved to your C:\Windows\System32 folder. You’ll need to find these files for later.
    • Go back to your Azure App Registration and select Certificates & Secrets from the left navigation.
    • Click Upload certificate. and select the .cer file you just created. Give it a name. The same Common Name is fine, but it can be anything.
    • Click Add to add your certificate to the App Registration.

    Configure the API Permissions

    Next, we want to configure the App Registration with the permissions it will need for SharePoint. For this demo, we’re assuming we want our Function App only to have access to a single SharePoint site collection. If you need additional permissions, choose accordingly. This can be updated later.

    • Select API Permissions in the App Registration left navigation.
    • Select Add permission and then select SharePoint.
    • Select Application permissions.
    • Select Sites.Selected.
    • Select Add Permission.
    • Now, on the Configured permissions screen, you’ll need to select Grant admin consent for .... If you are not the Azure Admin, you’ll need to ask the admin to do this.

    Allow Access to our demo site collection

    Since we selected Sites.Selected for our API Permissions, we next must specify which site collection the Function App should be allowed to access. Unfortunately, for now, this can only be done through PowerShell.

    • Open PowerShell with Admin privileges.
    • Run the following PowerShell after updating your SharePoint Site URL and App Id. The App Display Name can be anything.
    $targetSiteUrl = '{sharepoint site url}'
    Connect-PnPOnline $targetSiteUrl -Interactive
    Grant-PnPAzureADAppSitePermission -AppId '{app (client) id}' -DisplayName '{app display name}' -Site $targetSiteUrl -Permissions Write
    

    Get-PnPAzureADAppSitePermission -Site $targetSiteUrl

    Azure Function App

    Create the Azure Function App

    Next, we can create our Azure Function App in your Azure Portal.

    • Log into Azure Portal.
    • Find Function Apps.
    • Click Create.
      • Select or create a new Resource Group.
      • Function App Name: This is important as it will be the URL we will use to access the Function App.
      • Publish: Code
      • Runtime Stack: .NET
      • Version: 6
      • Region: Select your nearest region.
      • Operating System: Windows.
      • Plan Type: Consumption.
    • Everything else can use the defaults or be configured as you want for your organization.
    • Click Create and wait for the Function App to be created.
    • After the resource is created, click Get publish profile from the Overview screen to download the Publishing Profile you’ll use in Visual Studio to publish the Function App code.

    Add the Certificate to the Function App

    Our Function App will need the .pfx Certificate file corresponding to the .cer file we attached to our Azure App Registration.

    • Open the Function App.
    • Select Certificates from the left navigation.
    • Select the Bring your own certificates (.pfx) tab.
    • Select the Add certificate button, then choose Upload Certificate (.pfx) from the Source dropdown.
    • Upload the .pfx file you created earlier and enter the Certificate Password you created.
    • Give the certificate a friendly name, or leave the default.
    • Click Validate, then Add.
    • Copy the Thumbprint that was generated.
    • Select Configuration from the left navigation.
    • Select the New Application setting.
    • The name should be WEBSITE_LOAD_CERTIFICATES (be sure it matches exactly).
    • The value should be the thumbprint you copied earlier.
    • Select OK to save.

    While here, we can create the other Application Settings we will need. There are already some default Application Settings you can leave alone.

    • AppClientId: {Your Application (client) Id}
    • SiteCollectionUrl: {Your SharePoint Site URL}
    • AzureTenantId: {Your Azure App Registration Tenant Id}
    • RedirectUrl: http://localhost:{your local port}
    • WEBSITE_LOAD_CERTIFICATES: {Your Certificate Thumbprint}

    Click Save to save all of your changes. I forget this part all the time :).

    Prepare your Code

    Now for the fun part, we can set up Visual Studio and write some code!

    Create your project

    • Open Visual Studio and create a new project using the Azure Functions C# template.
    • Set the Functions worker to .NET 6.0, the Function to HTTP Trigger, and the Authorization level to Function.

    Pasted image 20221207093012

    NuGet Packages

    You’ll need to add some NuGet Packages to your project.

    • PnP.Framework by PnP is all we will need for this demo.

    local.settings.json

    Remember the Application Settings we created earlier in the Function App? These settings will work when running the app from Azure but not from your local machine.

    When you debug the Function App from Visual Studio, the settings from the local.settings.json file are used, not your Azure Application Settings.

    You will need to open the local.settings.json file created with your project and add the same settings.

    CleanShot 2022 12 07 at 13 05 13

    Function1.cs

    I created a simple example that authenticates to SharePoint and retrieves the list name we pass to the function. You can copy this into your default Function.

    
    using Microsoft.AspNetCore.Http;
    using Microsoft.AspNetCore.Mvc;
    using Microsoft.Azure.WebJobs;
    using Microsoft.Azure.WebJobs.Extensions.Http;
    using Microsoft.Extensions.Logging;
    using PnP.Framework;
    using System;
    using System.Security.Cryptography.X509Certificates;
    using System.Threading.Tasks;
    

    namespace DemoFunctionApp { public static class Function1 { [FunctionName(“Function1”)] public static async Task Run( [HttpTrigger(AuthorizationLevel.Function, “get”, “post”, Route = null)] HttpRequest req, ILogger log) { log.LogInformation(“Started request”);

            try
            {
                // Get values from the environment configuration
                var certThumbprint = System.Environment.GetEnvironmentVariable("CertThumbprint", EnvironmentVariableTarget.Process);
                var appClientId = System.Environment.GetEnvironmentVariable("AppClientId", EnvironmentVariableTarget.Process);
                var tenantId = System.Environment.GetEnvironmentVariable("AzureTenantId", EnvironmentVariableTarget.Process);
                var redirectUrl = System.Environment.GetEnvironmentVariable("RedirectUrl", EnvironmentVariableTarget.Process);
                var spSiteUrl = System.Environment.GetEnvironmentVariable("SiteCollectionUrl", EnvironmentVariableTarget.Process);
                var certificate = GetCertificate(certThumbprint);
                var responseMessage = String.Empty;
    
                // Get values from the querystring
                string spListName = req.Query["ListName"];
    
                // Validate
                if(String.IsNullOrEmpty(spListName))
                {
                    responseMessage = "Please provide a ListName querystring parameter.";
                    return new BadRequestObjectResult(responseMessage);
                }
    
                // Authenticate to SharePoint
                AuthenticationManager authManager = new AuthenticationManager(appClientId, certificate, tenantId, redirectUrl, AzureEnvironment.Production, null);
    
                using (var ctx = authManager.GetContext(spSiteUrl))
                {
                    var splist = ctx.Web.Lists.GetByTitle(spListName);
                    ctx.Load(splist);
                    ctx.ExecuteQuery();
                    responseMessage = splist.Title + " was retrieved";
                }
    
                return new OkObjectResult(responseMessage);
            }
            catch(Exception ex)
            {
                return new BadRequestObjectResult(ex.Message);
            }
        }
    
        private static X509Certificate2 GetCertificate(string thumbprint)
        {
            X509Certificate2 cert = null;
            X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
            certStore.Open(OpenFlags.ReadOnly);
            X509Certificate2Collection certCollection = certStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);
    
            if (certCollection.Count > 0)
            {
                cert = certCollection[0];
                Console.WriteLine(cert.FriendlyName);
            }
    
            certStore.Close();
            return cert;
        }
    }
    

    }

    • The code first retrieves the environment variables. As mentioned before, if you running in Azure, these variables are pulled from your Application Settings. If you run this locally, it will pull them from the local.settings.json file.
    • I also included one variable spListName, that pulls a value from the query parameter of the function. This is an example of how you can pass parameters through the request.
    • The GetCertificate method will retrieve the certificate we added in our Application Settings. If you want to debug locally you’ll need to add the certificate .pfx file to your local machine (see the next section).
    • Next, we use the PnP.Framework AuthenticationManager to authenticate to SharePoint and then retrieve the ClientContext. Once we have the ClientContext, we can do whatever we need to use standard CSOM.

    Adding the Certificate .pfx file to Windows

    If you want to debug your Azure Function from Visual Studio, you’ll need to add the certificate you created to your local machine.

    • Open Manage User Certificates from the Control Panel or search.
    • In the Personal > Certificates folder, right-click and select All Tasks > Import.
    • Click Next.
    • Click Browse, then change the file type at the bottom right to Personal Information Exchange.
    • Find your Certificates .pfx file that you created earlier.
    • Enter the Password you created for your certificate.
    • Click Next.
    • Click Next.
    • Click Finish.

    Debugging Locally

    When debugging locally, a terminal window should appear. It will provide a URL to your function so you can execute it locally. This also shows you the port you’ll need to add to your RedirectUrl in your local.settings.json.

    In my case, the URL is http://localhost:7297/api/Function1

    CleanShot 2022 12 07 at 13 07 22

    If you load the URL as-is in the browser, you should receive a validation error “Please provide a ListName query string parameter.” To fix this, append `?ListName={Your List Name} to the end of your URL and load it again.

    The code should execute and return the name of your list if it is successful.

    CleanShot 2022 12 07 at 13 09 00

    Publishing the Azure Function App

    Once you have things working locally, you can publish your Azure Function App.

    • Change your Solution Configuration to Release and build your project.
    • In Visual Studio, right-click on your project name.
    • Select Publish.
    • An option to Import should appear. Select the profile you downloaded earlier.
    • Continue and close the import window.
    • Click Publish.

    Testing the Azure Function App

    We can now test the Azure Function app in the browser.

    • Open the Function App in the Azure Portal.
    • Select Functions from the left navigation.
    • Select your function Function (unless you renamed it).
    • Select Code + Test from the left navigation.
    • Select Test/Run from the toolbar.
    • Click the Run button at the bottom.
    • You should receive a 400 Bad Request with the HTTP response content “Please provide a ListName querystring parameter.”.
    • Select the Input tab again.
    • Under Query, select Add parameter.
    • Enter the name “ListName” and value “{the name of your list}”
    • Click Run again.
    • When successful, the HTTP response code should return “200 OK,” and the HTTP response content should return the name of your list.

    While we’re here, click on Get Function URL in the toolbar and copy the URL to your notes.

    Calling the Azure Function App from Power Automate

    The last thing I’ll demonstrate is how to call this Azure Function App from Power Automate.

    • Create a new Power Automate Instant Flow with a Manual trigger.
    • In the “Manually trigger a flow” action, add a string input named ListName.
    • Next, add an HTTP action. Unfortunately, this is a Premium connector.
    • Set the method to “Get.”
    • Set the URI to the function URL you copied in the previous section but without the code parameter.
    • Add a header named “x-functions-key” and set the value to the code parameter you copied from your Function URL.
    • Add a Query named ListName and set it to the input parameter.
    • Test your flow.

     

    CleanShot 2022 12 07 at 13 09 35

    CleanShot 2022 12 07 at 13 10 29

    Conclusion

    I hope this was a helpful demonstration of how to use an Azure Function App with SharePoint Online!

  • Give a user access to see Platform Environments

    If a user does not see the Microsoft Power Platform Environment they need access to, you can add them by following these steps.

    • Log into the Power Platform Admin Center
    • Select the environment and go to Settings.
    • Under User + Permissions, select Users.
    • Select or add the user you want to allow access to.
    • Add the user to the Basic User role.
    • Click on Manage Security Roles.
    • Add the user to the Basic User role.
  • Permanently delete a SharePoint Online Office 365 Group

    You can permanently delete a Microsoft SharePoint Online Office 365 Group from your Azure Portal, but if you prefer to use PowerShell, here is an example.

    	Install-Module -Name AzureAD 
    	$tenantUrl = "https://{{yoursite}}-admin.sharepoint.com/" 
    	$groupToDelete = "{{groupname}}" 
    	Connect-SPOService -Url $tenantUrl 
    	Write-Output "Connected to $tenantUrl" 
    	Get-AzureADMSDeletedGroup $groupToDelete | Write-Output "Group $groupToDelete was found" 
    	#Remove-AzureADMSDeletedDirectoryObject –Id $groupToDelete
    
  • Azure App Registration for SharePoint

    When accessing Microsoft SharePoint Online from custom code, we’ll want to use an Azure App Registration to give the application access to SharePoint. 1

    Steps to setup Azure AD App-only access

    1. Create a self-signed certificate using PowerShell.
    2. Save the .cer and .pfx files and the information used to create the certificate.
    3. Create an Azure App Regsitration from Azure AD
    4. Under Certificates & Secrets, upload the .cer file created earlier.
    5. Under API Permissions, assign the appropriate permissions for the App. If the app needs permission to access specific SharePoint sites, select SharePoint Sites.Selected and then use PowerShell to Configure App Registration for SharePoint Sites.Selected.

    Sample Code

    This sample code is a simple .NET Console application. I added the PnP.Framework Nuget package to the project. Update the Program.cs file with the following code. Debug, and if successful, the console window should display the name of the SharePoint site collection.

    using Microsoft.SharePoint.Client;
    using PnP.Framework;
    using System;
    
    namespace Test.TestAppRegistration
    {
        internal class Program
        {
            static void Main(string[] args)
            {
                string siteUrl = "{sharepoint site url}";
                string tenant = "{tenant ID (from Azure AD)}";
                string pathPfx = "c:\\{path to cert file}\\Certificate.pfx";
                string aadAppId = "{app registration id}";
                string pfxPassword = "{certificate password}";
    
                AuthenticationManager authManager = new AuthenticationManager(aadAppId, pathPfx, pfxPassword, tenant);           
    
                using (ClientContext cc = authManager.GetContext(siteUrl))
                {
                    cc.Load(cc.Web, p => p.Title);
                    cc.ExecuteQuery();
                    Console.WriteLine(cc.Web.Title);
                };
    
                Console.ReadLine();
            }
        }
    }
    
    

    1. Granting access via Azure AD App-Only | Microsoft Learn ↩︎

  • Create a self-signed certificate using PowerShell

    Run the following PowerShell to create a self-signed certificate using Windows and PowerShell. 1

    #Requires -RunAsAdministrator
    <#
    .SYNOPSIS
    Creates a Self Signed Certificate for use in server-to-server authentication
    .DESCRIPTION
    .EXAMPLE
    .\Create-SelfSignedCertificate.ps1 -CommonName "MyCert" -StartDate 2015-11-21 -EndDate 2017-11-21
    This will create a new self-signed certificate with the common name "CN=MyCert". During creation, you will be asked to provide a password to protect the private key.
    .EXAMPLE
    .\Create-SelfSignedCertificate.ps1 -CommonName "MyCert" -StartDate 2015-11-21 -EndDate 2017-11-21 -Password (ConvertTo-SecureString -String "MyPassword" -AsPlainText -Force)
    This will create a new self-signed certificate with the common name "CN=MyCert". The password as specified in the Password parameter will be used to protect the private key
    .EXAMPLE
    .\Create-SelfSignedCertificate.ps1 -CommonName "MyCert" -StartDate 2015-11-21 -EndDate 2017-11-21 -Force
    This will create a new self-signed certificate with the common name "CN=MyCert". During creation, you will be asked to provide a password to protect the private key. If there is already a certificate with the common name you specified, it will be removed first.
    #>
    Param(
    
       [Parameter(Mandatory=$true)]
       [string]$CommonName,
    
       [Parameter(Mandatory=$true)]
       [DateTime]$StartDate,
    
       [Parameter(Mandatory=$true)]
       [DateTime]$EndDate,
    
       [Parameter(Mandatory=$false, HelpMessage="Will overwrite existing certificates")]
       [Switch]$Force,
    
       [Parameter(Mandatory=$false)]
       [SecureString]$Password
    )
    
    # DO NOT MODIFY BELOW
    
    function CreateSelfSignedCertificate(){
    
        #Remove and existing certificates with the same common name from personal and root stores
        #Need to be very wary of this as could break something
        if($CommonName.ToLower().StartsWith("cn="))
        {
            # Remove CN from common name
            $CommonName = $CommonName.Substring(3)
        }
        $certs = Get-ChildItem -Path Cert:\LocalMachine\my | Where-Object{$_.Subject -eq "CN=$CommonName"}
        if($certs -ne $null -and $certs.Length -gt 0)
        {
            if($Force)
            {
    
                foreach($c in $certs)
                {
                    remove-item $c.PSPath
                }
            } else {
                Write-Host -ForegroundColor Red "One or more certificates with the same common name (CN=$CommonName) are already located in the local certificate store. Use -Force to remove them";
                return $false
            }
        }
    
        $name = new-object -com "X509Enrollment.CX500DistinguishedName.1"
        $name.Encode("CN=$CommonName", 0)
    
        $key = new-object -com "X509Enrollment.CX509PrivateKey.1"
        $key.ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
        $key.KeySpec = 1
        $key.Length = 2048
        $key.SecurityDescriptor = "D:PAI(A;;0xd01f01ff;;;SY)(A;;0xd01f01ff;;;BA)(A;;0x80120089;;;NS)"
        $key.MachineContext = 1
        $key.ExportPolicy = 1 # This is required to allow the private key to be exported
        $key.Create()
    
        $serverauthoid = new-object -com "X509Enrollment.CObjectId.1"
        $serverauthoid.InitializeFromValue("1.3.6.1.5.5.7.3.1") # Server Authentication
        $ekuoids = new-object -com "X509Enrollment.CObjectIds.1"
        $ekuoids.add($serverauthoid)
        $ekuext = new-object -com "X509Enrollment.CX509ExtensionEnhancedKeyUsage.1"
        $ekuext.InitializeEncode($ekuoids)
    
        $cert = new-object -com "X509Enrollment.CX509CertificateRequestCertificate.1"
        $cert.InitializeFromPrivateKey(2, $key, "")
        $cert.Subject = $name
        $cert.Issuer = $cert.Subject
        $cert.NotBefore = $StartDate
        $cert.NotAfter = $EndDate
        $cert.X509Extensions.Add($ekuext)
        $cert.Encode()
    
        $enrollment = new-object -com "X509Enrollment.CX509Enrollment.1"
        $enrollment.InitializeFromRequest($cert)
        $certdata = $enrollment.CreateRequest(0)
        $enrollment.InstallResponse(2, $certdata, 0, "")
        return $true
    }
    
    function ExportPFXFile()
    {
        if($CommonName.ToLower().StartsWith("cn="))
        {
            # Remove CN from common name
            $CommonName = $CommonName.Substring(3)
        }
        if($Password -eq $null)
        {
            $Password = Read-Host -Prompt "Enter Password to protect private key" -AsSecureString
        }
        $cert = Get-ChildItem -Path Cert:\LocalMachine\my | where-object{$_.Subject -eq "CN=$CommonName"}
    
        Export-PfxCertificate -Cert $cert -Password $Password -FilePath "$($CommonName).pfx"
        Export-Certificate -Cert $cert -Type CERT -FilePath "$CommonName.cer"
    }
    
    function RemoveCertsFromStore()
    {
        # Once the certificates have been been exported we can safely remove them from the store
        if($CommonName.ToLower().StartsWith("cn="))
        {
            # Remove CN from common name
            $CommonName = $CommonName.Substring(3)
        }
        $certs = Get-ChildItem -Path Cert:\LocalMachine\my | Where-Object{$_.Subject -eq "CN=$CommonName"}
        foreach($c in $certs)
        {
            remove-item $c.PSPath
        }
    }
    
    if(CreateSelfSignedCertificate)
    {
        ExportPFXFile
        RemoveCertsFromStore
    }
    

    1. Granting access via Azure AD App-Only ↩︎

  • Configure App Registration for SharePoint Sites.Selected

    We want to give access to a specific Microsoft SharePoint Online site collection from an Azure App Registration.

    Create the App Registration in Azure

    • Open Azure Portal.
    • Browse to Azure AD.
    • Select App Registration.
    • Select New App Registration.
    • Give it a name.
    • Copy the Application Id.
    • In Certificates & Secrets, give it a Client Secret.
    • Copy the Client Secret Value.
    • In API Permissions, give the following permissions.
      • SharePoint
        • Sites.Selected
    • Grant admin consent for each of the permissions.

    Grant permissions to select sites using PowerShell

    • Run the following PowerShell
    $targetSiteUrl = '{sharepoint site url}'
    Connect-PnPOnline $targetSiteUrl -Interactive
    Grant-PnPAzureADAppSitePermission -AppId '{app (client) id}' -DisplayName '{app display name}' -Site $targetSiteUrl -Permissions Write
    
    Get-PnPAzureADAppSitePermission -Site $targetSiteUrl
    

    Revoke Permission via PowerShell

    $targetSiteUrl = '{sharepoint site url}'
    Connect-PnPOnline $targetSiteUrl -Interactive
    Revoke-PnPAzureADAppSitePermission -PermissionId '{permissionid}' -Site $targetSiteUrl -Force
    
    Get-PnPAzureADAppSitePermission -Site $targetSiteUrl
    

    References

  • Use NVM to manage Node versions

    NVM allows you to install multiple versions of Node.js onto your machine, allowing you to switch between Node.js versions without actually reinstalling quickly.

    Why do you need multiple versions of Node.js?

    If you work with different types of apps, you may have specific dependencies. For example, I had to pull code for an SPFx web part to package and deploy it. The application's dependencies required me to use a different version of Node.js than what I had installed.

    Get NVM

    Common Commands

    • nvm list available Get a list of available Node.js versions
    • nvm list Get a list of installed versions of Node.js
    • nvm install {version number} to install a new version
    • nvm uninstall {version number} to uninstall a version.
    • nvm use {version number} to switch to an installed version of Node.js

    References

    https://www.andrewconnell.com. 2017. "Andrew Connell - Better Node.Js Install Management with Node Version Manager." Andrew Connell. April 26, 2017. https://andrewconnellpreview.z13.web.core.windows.net/blog/better-node-js-install-management-with-node-version-manager/.

  • Microsoft Power Apps Icons

    Microsoft Power Apps has a few icons built-in that we can use in our applications. If you want more options, you can follow these simple steps.

    • Go to the site Power Apps Icons.
    • Search for the icon name to find the one you want.
    • Click the color of the icon to choose the color.
    • Right-click the Power Apps Code and choose Copy > Copy value.
    • Open your Power App.
    • Add an image control.
    • Paste the Power Apps Code into the Image property.
  • Check for a null Field value in Power Automate

    If you are using Microsoft Power Automate with Microsoft SharePoint Online list or library data and need to check if a field is empty or null, you can use the @empty function in an expression.

    Example

    The following example involves setting up a new Power Automate workflow triggered when a user starts the workflow from the SharePoint list. The workflow will check if the “President” column is empty and update the “Is Empty” column with the result.  

    Create a SharePoint List

    Example SharePoint List

    • Create a new SharePoint list. This demo uses the default Title column, a choice column called President, and a Boolean column called “Is Empty.” 
    • Add some sample data. Leave the President column blank for some items.

    Create a Power Automate Flow

    Example Power Automate Flow

    • Create a new Power Automate Automated Cloud Flow. Select For a selected item as the trigger action. Select your SharePoint site and list it in this action.
    • Add the Get Item action and configure it to retrieve the selected item from the list. This step is necessary to retrieve all the columns so we can use them in the workflow. Set the ID to the ID of the For a Selected Item trigger.
    • Add the Initialize Variable action. We want to use the empty() function with our President column in the Value. The full expression is empty(outputs(‘Get_item’)?‘body/President/Value’).

    Power Automate IsEmpty() Expression

    • Add an Update Item action that is pointed to your list and set the Is Empty column.

    Power Automate SharePoint Item Action

    • Save the workflow.

    Test your workflow

    • Now, go back to your list and select an item with an empty President value. Under the Automate menu, you should see your workflow listed (it may take a few seconds to load). Please select it and run the workflow.

    SharePoint List Example

    • Refresh your list after a few seconds; the Is Empty column should be checked
    • Try running the workflow on a row that has a President selected. The Is Emptyshould not be checked.

    SharePoint List Example

    • Open the workflow that you ran. You can see that the variable we created resulted in True when the column was empty and False when it was not.
  • Adobe Sign Licensing

    The following describes Adobe Sign licensing.

    • A “transaction” is when a file is sent to Adobe Sign, regardless of several signatures or other configurations.
    • No development transactions.
    • A subscription is for 1 year with no rollover.
    • Notifications will be sent at 80%, 90%, and 100% of total transactions.
    • A trial can be created, but it does not work with Power Automate. You’ll need to purchase a bundle of transactions (about $5 each) for testing to get around this.
  • Add a double quote as part of your text in Power Apps

    When writing text in Microsoft Power Apps controls, you may need to add a double quote as part of your text. Power Apps uses the Power Fx language. It would be best to convert the " to &Char(34) to encode them into the correct character.

RSS