Forum Discussion

Huw_013's avatar
Huw_013
Copper Contributor
Aug 26, 2025

Automating metadata updates

We use Modern SharePoint.  In it, among others, we have the following fields:

 

Document ID (Auto Generated on “rules)

Name (which is the file name)

Title (currently empty)

 

In this order we would like to:

 

Take the file extension off the name (file name) and store it in a temporary field called file extension

Move the resulting Name in the Title field

Attach the file extension to the Document ID (which would then link to the actual file)

Is this possible?

2 Replies

  • Rob_Elliott's avatar
    Rob_Elliott
    Bronze Contributor

    As Dave mentioned, this can be done with a flow in Power Automate. It's not difficult but some of the expressions & actions might not be obvious or trip you up if you are not very experienced with Power Automate. So I'll demonstrate how to do it. I've used the classic designer in Power Automate as I find this easier to do screenshots with.

    I created a library called Metadata. The DocumentID column needs to be a hyperlink type. I've uploaded an image file so the full filename with extension goes into the Name column but nothing goes into the Title column.

     

    The trigger for the flow is "When a file is created (properties only)". Select the site address and library name.

    The initialize a string variable for the documentID. I've named this varDocumentID, it's a string variable and I've set the ID to be the name of the file then a dash then the ID of the uploaded file, so this will end up being T0805-5

    Next, a compose action has been added to hold the link to the library followed by /

     

    Next, 3 more compose actions are added and renamed as follows:

    • File - select Name from the dynamic content box - this will result in T0805
    • Filename - select Filename with extension - this will result in T0805.png
    • Extension - click the expression tab in the dynamic content box and type/paste in the following expression

      last(split(outputs('Filename'),'.'))

     

    This splits the Filename compose on the dot and gets the last part of it, i.e .png

     

    The last action in the flow is more complex, it is "Send an HTTP request to SharePoint" which will

    1. add the outputs of the File compose, T0805, to the Title column. 
    2. for the DocumentID column set the description (the text that is displayed) to be the outputs of the varDocumentID variable.
    3. set the url to be the outputs of the Link compose immediately followed by the outputs of the Filename compose.

     

    Select the site address and the Method which is Post.

    For the URI field enter/paste in

    _api/web/lists/GetByTitle('Metadata')/items() - inside the parentheses select ID from the when a file is created section of the dynamic content box.

    For the Headers field click the T symbol to the right of the field and type/paste:

    {
      "Content-Type": "application/json;odata=verbose",
      "X-HTTP-Method": "MERGE",
      "IF-MATCH": "*"
    }

    Then click the T again.

    Then in the Body field type/paste:

    {
        "__metadata": {
            "type": "SP.Data.MetadataItem"
        },
       "Title": "Outputs of File compose",
        "DocumentID": {
            "Description": "Outputs of varDocumentID variable",
            "Url": "Outputs of Filename compose"
        }
    }

    where Metadata in the second line is the name of your library with no space between it and Item.

    This is the result which I think meets what you want to achieve. Clicking on the link in the DocumentID column opens the name of the file in the Name column.

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, Power Platform, WSP Global (and classic 1967 Morris Traveller driver)

Resources