Power Automate: Retrieve SharePoint Library Internal Name
Power Automate: Retrieve SharePoint Library Internal Name
When working with Power Automate, you may encounter scenarios where you need the internal name of a SharePoint library. For example, when creating a file in a library using Power Automate, the internal name is often required. Instead of manually adding the internal name as an environment variable, you can dynamically retrieve it using the Send an HTTP Request to SharePoint
action.
This blog post demonstrates how to retrieve the internal name of a SharePoint library using its ID or display name.
Steps to Retrieve the Library Internal Name
1. Add the Send an HTTP Request to SharePoint
Action
Rename the action to something meaningful, such as Get Library Internal Name, for better readability.
Action Properties
Property | Value |
---|---|
Site Address | The SharePoint site URL |
Method | GET |
Uri | See the Uri section below |
Uri
Use the following Uri to retrieve the library’s internal name:
_api/web/lists(guid'parameters('Documents Library (cv_documentslibrary)')')?$select=EntityTypeName
This Uri uses the library’s GUID (retrieved from an environment variable in this example) to fetch its internal name.
2. Execution of the flow
When the flow runs, the Send an HTTP Request to SharePoint
action returns the following response:
"body": {
"d": {
"__metadata": {
"id": "https://contoso.sharepoint.com/teams/d-team-playground/_api/Web/Lists(guid'0848c64e-5aa0-493d-bc7b-f2891946214b')",
"uri": "https://contoso.sharepoint.com/teams/d-team-playground/_api/Web/Lists(guid'0848c64e-5aa0-493d-bc7b-f2891946214b')",
"etag": "\"62\"",
"type": "SP.List"
},
"EntityTypeName": "ApprovedControlledDocuments"
}
}
The EntityTypeName
field contains the internal name of the library, which in this case is ApprovedControlledDocuments
.
3. Use the Internal Name in Subsequent Actions
You can reference the retrieved internal name in subsequent actions. For example, in a Create File
action, you can use the following expression to dynamically reference the internal name:
body('Get_Approved_Controlled_Documents_Internal_Name')?['d']?['EntityTypeName']
This ensures that the internal name is dynamically retrieved and used without hardcoding it.
Example: Create File Action
In the example below, the internal name is used in a Create File action to specify the target library.
Benefits of This Approach
Dynamic Retrieval: Eliminates the need to manually add the internal name as an environment variable. Simplified Maintenance: Reduces the risk of errors caused by hardcoding library names. Reusable: The approach can be reused across multiple flows and libraries.