cancel
Showing results for 
Search instead for 
Did you mean: 
eliotcole

Convert SharePoint ListId/GUID to URL using Power Automate

This simple 3 step flow will convert an easily found listId / GUID into a usable URL.

01 initialise the URL variable.jpg

 

02 Get lists.jpg

 

03 Apply to each.jpg

 

I did not make a cookbook because I don't wish to upload ZIPs of my flows as they contain information.

 

The reason I needed it is that there's no (programmatical) simple way to reliably get the URL of a list, since the list name may have been changed since it was created. This is almost 100% true for all of my lists, since when I create them I make them with a one word, URL friendly, name, to avoid the %20 encoding effect and keep things tidy.

 

I use this in my master "list of lists" which then catalogues all the lists that I have on every site. That will be added shortly.

 

I think you should be OK to skip steps 6, 7, and 8, and just use the reference schema code that I've put at the end, but it's your lookout there.

 

  1. Create a 'Instant' flow, or whatever you need to do.
  2. Create an 'Initialize variable' action with a 'Type' of "STRING" and name it " urlVAR " (or whatever you do for naming)
    01 initialise the URL variable.jpg
  3. Create a SharePoint 'Get_lists' action for the site in question.
    02 Get lists.jpg
  4. Create an 'Apply to each' Control action for the value reported from the 'Get_lists'. The tooltip should read:
    outputs('Get_lists')?['body/value']​​​
  5. In the 'Apply to each' action create a SharePoint 'Send an HTTP request to SharePoint' action for the site in question with the following entries, you can leave the 'Body' value blank:
    0301 Apply to each - HTTP request.jpg
    - 'Site Address' - Select the same site as in 'Get lists'
    - 'Method' - Select "Get"
    - 'Uri' - Set this to
    _api/web/lists(guid'[NAME]')​​
    ... where " [NAME] " is the "Name" dynamic content from the 'Get lists' which should have the tooltip text of:
    items('Apply_to_each')?['Name']​​
    - 'Headers' - The output should be JSON, but if we put the following in here it will ensure that:
    {
    "Accept": "application/json;odata=nometadata"
    }​​
  6. Create a 'Compose' action, and in the 'Inputs' field, select the 'body' from the HTTP request (Flow Step 3).
    compose.jpg
  7. Run a test of the flow.
    This will give us the body JSON that we need to perform a parse JSON in the final build of the flow.
    Copy the 'Output' content from this 'Compose' action. 
  8. After the test has run, go back and edit the flow, and delete the 'Compose' action.
  9. After the HTTP request create a 'Parse JSON' action, then:
    0302 Apply to each - Parse JSON.jpg
    - Set the 'Content' field to the body Dynamic content from the HTTP request, it should give something like the following tooltip:
    outputs('Send_an_HTTP_request_to_SharePoint')?['body']​​
    - Paste the copied data from the 'body' run into the 'Schema' field.
  10. Finally create a 'Set variable' action to get the URL, enter the site URL, followed by /Lists/, then we'll add an expression, it should look like this:
    0303 Apply to each - Set Variable.jpg
    The 'Value' field should be:
    [SITE URL]/Lists/[EXPRESSION]​
    Where [SITE URL] is your Site URL, and [EXPRESSION] is:
    substring(body('Parse_JSON')?['ListItemEntityTypeFullName'],8,add(length (body('Parse_JSON')?['ListItemEntityTypeFullName']),-16))​

 

 

Most of the work is done in the expression in the Set variable' action, which is basically trimming the site "name" out of the extracted information. I used  this solution to help with that:

https://powerusers.microsoft.com/t5/Building-Flows/MS-Flow-Variable-Remove-Last-Character-In-a-Strin...

Hope that this can help folks out elsewhere.

If someone needs me to put this in the form of a question, and then answer it myself, I'm more than happy to, but I'm just not uploading my information in a zip format.

 

------------

Reference

 

You should be OK to skip the steps mentioned, as I believe that this code will work anywhere:

 

 

 

 

{
    "type": "object",
    "properties": {
        "AllowContentTypes": {
            "type": "boolean"
        },
        "BaseTemplate": {
            "type": "integer"
        },
        "BaseType": {
            "type": "integer"
        },
        "ContentTypesEnabled": {
            "type": "boolean"
        },
        "CrawlNonDefaultViews": {
            "type": "boolean"
        },
        "Created": {
            "type": "string"
        },
        "CurrentChangeToken": {
            "type": "object",
            "properties": {
                "StringValue": {
                    "type": "string"
                }
            }
        },
        "DefaultContentApprovalWorkflowId": {
            "type": "string"
        },
        "DefaultItemOpenUseListSetting": {
            "type": "boolean"
        },
        "Description": {
            "type": "string"
        },
        "Direction": {
            "type": "string"
        },
        "DisableGridEditing": {
            "type": "boolean"
        },
        "DraftVersionVisibility": {
            "type": "integer"
        },
        "EnableAttachments": {
            "type": "boolean"
        },
        "EnableFolderCreation": {
            "type": "boolean"
        },
        "EnableMinorVersions": {
            "type": "boolean"
        },
        "EnableModeration": {
            "type": "boolean"
        },
        "EnableRequestSignOff": {
            "type": "boolean"
        },
        "EnableVersioning": {
            "type": "boolean"
        },
        "EntityTypeName": {
            "type": "string"
        },
        "ExemptFromBlockDownloadOfNonViewableFiles": {
            "type": "boolean"
        },
        "FileSavePostProcessingEnabled": {
            "type": "boolean"
        },
        "ForceCheckout": {
            "type": "boolean"
        },
        "HasExternalDataSource": {
            "type": "boolean"
        },
        "Hidden": {
            "type": "boolean"
        },
        "Id": {
            "type": "string"
        },
        "ImagePath": {
            "type": "object",
            "properties": {
                "DecodedUrl": {
                    "type": "string"
                }
            }
        },
        "ImageUrl": {
            "type": "string"
        },
        "IrmEnabled": {
            "type": "boolean"
        },
        "IrmExpire": {
            "type": "boolean"
        },
        "IrmReject": {
            "type": "boolean"
        },
        "IsApplicationList": {
            "type": "boolean"
        },
        "IsCatalog": {
            "type": "boolean"
        },
        "IsPrivate": {
            "type": "boolean"
        },
        "ItemCount": {
            "type": "integer"
        },
        "LastItemDeletedDate": {
            "type": "string"
        },
        "LastItemModifiedDate": {
            "type": "string"
        },
        "LastItemUserModifiedDate": {
            "type": "string"
        },
        "ListExperienceOptions": {
            "type": "integer"
        },
        "ListItemEntityTypeFullName": {
            "type": "string"
        },
        "MajorVersionLimit": {
            "type": "integer"
        },
        "MajorWithMinorVersionsLimit": {
            "type": "integer"
        },
        "MultipleDataList": {
            "type": "boolean"
        },
        "NoCrawl": {
            "type": "boolean"
        },
        "ParentWebPath": {
            "type": "object",
            "properties": {
                "DecodedUrl": {
                    "type": "string"
                }
            }
        },
        "ParentWebUrl": {
            "type": "string"
        },
        "ParserDisabled": {
            "type": "boolean"
        },
        "ServerTemplateCanCreateFolders": {
            "type": "boolean"
        },
        "TemplateFeatureId": {
            "type": "string"
        },
        "Title": {
            "type": "string"
        }
    }
}

 

 

 

 

 Tags (because this text input can sometimes ruin stuff):

SharePoint, SharePoint List, SharePoint Lists, List, Lists, URL, List URL

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/