Extract target file link from the shortcut link (.url) in SharePoint library
Use Case:
To get or extract the actual file link from the shortcut link (.url) present in the SharePoint library.
Solution:
In this example, we are extracting the link on creation or addition of a file so I have used an automated trigger "When a file is created (properties only)" but you may choose the trigger as per your need.
Choose SharePoint site URL & library name in the input parameters:
Add "Get file content" action. Pass the file identifier dynamically from the output of trigger:
Finally add a "Compose" action to get the actual link of a file. We will enter an expression to get the value of required link. Expression needs to be added in the Function box as shown below:
trim(last(split(decodeBase64(body('Get_file_content')?['$content']),'URL=')))
The output of compose action will give the actual link of shortcut link(.url).
Output:
Conclusion:
We can extract the actual link of a file from SharePoint library by decoding the base64 content of link object and parsing that decoded string using complex expression.
*This post is locked for comments