Workflow Automation with Microsoft Power Automate
上QQ阅读APP看书,第一时间看更新

Learning about file connectors and actions

In Chapter 3, Working with Email, you saw that Power Automate can work with files as attachments to emails. Work processes that require us to automate file attachments may also benefit from automating further processing with those files. Files may need to be copied or moved, uploaded to a new service, ingested into another platform, archived, or require approvals. Learning how to reference files and their properties is an important building block to building more complex flows.

Here's a quick rundown of some of the file storage mechanisms that we can use:

  • SharePoint Online
  • OneDrive for Business
  • OneDrive
  • Azure File Storage
  • Google Drive
  • Box
  • Dropbox

Most organizations will use Power Automate primarily within the context of SharePoint Online and OneDrive for Business. However, most organizations also have access to or use other file hosting and sharing mechanisms as part of their manual business processes when working with partners, customers, or vendors, so it's important to be able to interact with as many platforms as possible.

File connectors typically have the following types of trigger actions available, allowing you to create automated flows:

  • When a file is created
  • When a file is modified
  • When a file's properties are modified

Similar to the email connector actions, file connectors allow you to perform the following types of actions (depending on the connector and what APIs the service has available):

  • Update a file.
  • Copy a file.
  • Get the metadata of a file.
  • Delete a file.
  • List files or folders.
  • Create or delete folders.
  • Extract an archive file.
  • Create file sharing links.
  • Check in or check out a file.

Finally, the connectors allow you to manage and manipulate the content and metadata properties of the files, such as the following:

  • The name or DisplayName of a file or folder
  • The unique ID of a file or folder
  • The path
  • The LastModified date and time
  • The MediaType of the file

In addition to being able to use the available metadata of the files themselves, you may be able to include dynamic properties from other parts of the flow, as well as include them as part of your file handling procedure. 

Building on the concepts of dynamic content that we saw in Chapter 3, Working with Email, we're going to introduce a new concept: expressions. While dynamic content is used in the context of Power Automate to describe content properties derived from object metadata, expressions can be used to perform further processing in programmatic methods. If you are familiar with using Microsoft Excel formulas, then you'll notice that the concepts and formatting are similar. 

Expressions are frequently used to calculate and format values. We're going to use an expression (or formula) to create custom folder names as part of working with files in the next section.