Libraries in Canvas App

In Canvas apps, libraries are a way to store and reuse custom code that can be shared across multiple screens and apps. A library can contain one or more custom functions that you define, which can be used in formulas throughout your app.

Libraries are particularly useful if you have complex or frequently used formulas that you want to reuse across multiple apps or screens. By storing these formulas in a library, you can avoid duplicating code and make it easier to maintain and update your app.

To create a library in a Canvas app:

  1. Open your app in the Power Apps Studio.
  2. Click on the “View” tab in the ribbon at the top of the screen.
  3. Click on “Libraries” to open the libraries pane.
  4. Click on “New Library” to create a new library.
  5. In the “Name” field, enter a name for the library.
  6. In the “Description” field, enter a description for the library (optional).
  7. Click on “New Function” to create a new function in the library.
  8. In the “Name” field, enter a name for the function.
  9. In the “Inputs” section, add input parameters for the function (if any).
  10. In the “Output” section, set the data type for the function output.
  11. In the formula bar, write the formula code for the function.
  12. Click on “Save” to save the function.
  13. Repeat steps 7-12 for each function you want to add to the library.

Once you have created one or more functions in your library, you can use them in formulas throughout your app. To use a function from a library in a formula, you must first add the library to your app:

  1. Click on the “File” tab in the ribbon at the top of the screen.
  2. Click on “App settings” to open the app settings pane.
  3. Click on “Advanced settings”.
  4. In the “References” section, click on “Add reference”.
  5. Select the library you want to add from the list of available libraries.
  6. Click on “Add”.

Once you have added a library to your app, you can use its functions in formulas by prefixing the function name with the library name, separated by a period. For example, if you have a library called “MyLibrary” with a function called “AddNumbers”, you can use it in a formula like this:

MyLibrary.AddNumbers(1, 2, 3)

This would call the “AddNumbers” function in the “MyLibrary” library, passing in the values 1, 2, and 3 as arguments.

There are several libraries available in Canvas App that provide additional functionality to the app. Here are some of the libraries:

  1. PowerApps-Tools: Provides a set of tools for working with solutions and flows in PowerApps.  
  2. PDFViewer: Allows users to view and interact with PDF files within an app.  
  3. Chart: Provides a set of tools for creating and working with charts.  
  4. Office365Users: Allows users to access user profiles and other information from Office 365.  
  5. SharePoint: Provides a set of tools for working with SharePoint lists and libraries.  
  6. Azure AD: Allows users to authenticate and authorize access to Azure Active Directory.  
  7. Azure Blob Storage: Provides a set of tools for working with Azure Blob Storage.  
  8. Dynamics 365: Allows users to access data from Dynamics 365.  
  9. Bing Maps: Provides a set of tools for working with Bing Maps and location data.  
  10. Twitter: Allows users to access Twitter data and perform actions such as tweeting and searching for tweets.  
  11. Cognitive Services: Provides a set of tools for working with Microsoft’s Cognitive Services, including image recognition and natural language processing.  
  12. Google Analytics: Allows users to access data from Google Analytics.  
  13. OneDrive: Provides a set of tools for working with OneDrive files and folders.  
  14. PowerApps Notification: Allows users to send push notifications to PowerApps users.  
  15. Salesforce: Allows users to access data from Salesforce.

Posted

in

by

Tags: