0

I need my app to create a URL to a Sharepoint Custom List AllItems view. Within the app, I can only see https://mycompany.com/ and ListId=xyz.

Constraints:

  • I do not have access to the Custom List DisplayName

  • This must be automated, no API calls, no manual looking at a website, etc.

Is it possible to determine the URL for the AllItems view of a Sharepoint Custom List, if you only know the SiteName and ListID?

  • The url to a list is always the internal name (the first name it had when created). So if you have the real internal name, the path would be any URL + /Lists/listInternalName – Christoffer Oct 26 '19 at 16:58
2

I have listed out some approaches, please follow any of them from the below:

Approach 1:

<Your Site URL>/_layouts/15/listedit.aspx?List=<your list id>

Example:

https://globalsharepoint.sharepoint.com/sites/TestSite/_layouts/15/listedit.aspx?List=%7B356640B5%2D9F55%2D4468%2D8AA9%2DA8C34ED29490%7D

Now if you access this url - you will get the list name - then you can construct the url with the list name.

Approach 2:

<Your Site URL>/_vti_bin?LIST=<List ID>

Example:

https://globalsharepoint.sharepoint.com/_vti_bin?LIST={356640B5-9F55-4468-8AA9-A8C34ED29490} 

Approach 3:

Execute the below PowerShell script to get the list name.

Get-SPSite "http://SharePointserver/sites/TestSite/" | Get-SPWeb -Limit ALL | %{$_.Lists} |?{$_.ID –eq "356640B5-9F55-4468-8AA9-A8C34ED29490"} |ft Title, ParentWebURL, RootFolder

Note: In the above script change the site url and list id with your actual one.

Updated (11.01.2019) - generating the default list view url from list id:

Step 1:

I know my site url and list ID as below: Site URL : https://globalsharepoint.sharepoint.com/sites/TestSite ListID="356640B5-9F55-4468-8AA9-A8C34ED29490"

Construct the URL to get the "list title" from list edit page like below: +"_layouts/15/listedit.aspx?List="+ListID

https://globalsharepoint.sharepoint.com/sites/TestSite/_layouts/15/listedit.aspx?List=%7B356640B5%2D9F55%2D4468%2D8AA9%2DA8C34ED29490%7D Getting the "list title" from list edit page like below

Step 2: From the above step 1 got the list title as "Test List"

Now lets generate the default list view URL as like below: Syntax: +"/Lists/"+ListTitle (we got from the above step) Example: https://globalsharepoint.sharepoint.com/sites/TestSite/Lists/Test List

Now lets access this url - we will land into the default list view page like below: Getting the default list view url from the list title

| improve this answer | |
  • Approach 1 takes me to List Settings for a given list. How do I get to the AllItems View? – SeaDude Oct 28 '19 at 3:10
  • I cannot get Approach 2 to work. When I execute https://myCompany.sharepoint.com/_vti_bin?LIST={<myListID>}, the service inserts a "/" before the "?" and URL encodes the "{}" (https://myCompany.sharepoint.com/_vti_bin/?LIST=%7B<myListID>%7D). The screen shows as blank. – SeaDude Oct 28 '19 at 3:21
  • @SeaDude: Using the Approach 1 if you just construct the URL like below, you will get the "All Items" view.globalsharepoint.sharepoint.com/sites/TestSite/Lists/Test List Note: From the existing Approach you know the list name....so after the your site url just append /Lists/<Your List Name> - this will land you to the AllItems view page. – Habibur Rahaman Oct 28 '19 at 18:03
  • I'm sorry but neither Approach 1 nor Approach 2 work for me. Approach 3 is not an option as I cannot make a PowerShell call nor API call of any kind from this application. I have only <my Site URL> and <the List ID> as inputs. I need to transform these into a URL for the AllItems view of the List. Perhaps this is not possible? – SeaDude Oct 31 '19 at 5:16
  • @SeaDude : This is possible with the combinations of my approach 1 and my latest comment, today I will send you the screenshot how I did.... please follow my approach 1 and u – Habibur Rahaman Oct 31 '19 at 8:36
0

You can do this with Power Automate ("Flow" henceforth).

I can't remember the full approach (I've got it saved elsewhere and will edit in when I do), but the bare bones are:

  1. Use a SharePoint 'Get Items' for the list using the listId
  2. Parse the JSON of the result of that.
  3. Pick out either the '{Path}' or maybe '{FullPath}' fields from the JSON.

Therefor whatever the current path of the list is (I tend to create mine short, then change the list name afterwards to avoid URL encoding) it will be listed here through your flow.

You don't need any special access to get this, or any API calls.

I have a flow somewhere (possibly at an old job, but I exported some non-information holding flows) that basically listed all my lists, and provided a link to them, without ever knowing the actual URL to start with.

EDIT 1

OK, I can't find the actual flow, but I do have it somewhere, sorry, I'll keep an eye out ... but I only have one of those these days.

In the meantime I have a very simple API interaction that is fully automated for you. I'm going to explain this in the context of creating a link to every list in a given site, when you don't necessarily know anything about them.

By the way, this interaction is using the (free) official SharePoint HTTP request action in Flow. It is literally just one line, that's it, and all it's doing is asking for information about a list by the GUID that is given earlier.

The end result is a 3 step flow (4 parts in one, though) that finds all the lists in a site and provides a URL for each of them. I use this to populate a separate list, which I use as an index to find the lists that I need. In time I'll probably add metadata, etc, to that.

  1. Create a new flow with:
    • Flow Step 1: 'Initialize variable' action with a 'Type' of "STRING" and name it "urlVAR"
    • Flow Step 2: A SharePoint 'Get_lists' action for the site in question.
  2. Flow Step 3: Create an 'Apply to each' Control action for the value reported from the 'Get_lists'. The tooltip should read: outputs('Get_lists')?['body/value']
  3. Apply to each Step 1: 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:
    • '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 it: { "Accept": "application/json;odata=nometadata" }
  4. Apply to each Step 2: Create a 'Compose' action, and in the 'Inputs' field, select the 'body' from the HTTP request (Flow Step 3).
  5. Run a test run of the flow, and copy the contents returned from the 'Compose' action.
  6. New Apply to each Step 2: Delete the 'Compose' action and replace it with a 'Parse JSON' action, then:
    • 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']
    • Click 'Generate from sample' and paste the copied data from the 'body' run.
  7. Flow Step 5: Add a 'Set variable' action for the listUrlVAR to your site url, followed by /Lists/, then this Expression: substring(body('Parse_JSON')?['ListItemEntityTypeFullName'],8,add(length (body('Parse_JSON')?['ListItemEntityTypeFullName']),-16))

All the action here happens in the 'Apply to each' section (#2 above) that will query SharePoint for the list's information from each entry that the 'Get lists' action pulls .

The JSON parser will understand that, and report back the various fields that are received.

Finally the expression selects the text that is 8 characters from the start and 8 characters (16 characters in total) from the end of the ListItemEntityTypeFullName field that the HTTP request called. This is the name of the list that was previously unknown.

So you've gone from knowing nothing about any lists on a given site, to having the link to every single one. There is even the possibility to do a whole lot more with those urls since you can programatically use the results to perform automated tasks that add/edit/delete information or the lists themselves using their URL and the standard Power Automate SharePoint actions.

I have mapped this out more visually over in the flow community: https://powerusers.microsoft.com/t5/Connecting-To-Data/SharePoint-ListId-GUID-to-URL-Converter/m-p/594928#M9146


Extras

The below might not be perfect since when I pasted it a curly bracket went outside of the code, I think I put it back in, but I can't be sure ... maybe just use this as reference.

JSON Schema:

{
"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"
    }
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.