Get PNP List and NO URL!!!!

ComputerHabit 1,031 Reputation points
2022-03-30T21:51:32.923+00:00

Why can't I get to the URL????

188572-image.png

Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint Development
Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} vote

Accepted answer
  1. Rob Windsor 2,001 Reputation points
    2022-03-31T00:55:36.847+00:00

    I'm not a PowerShell expert, so I'm not sure why the Url property shows when you display the $list object. But as a developer I know that you get the URL for the list from the ServerRelativeUrl property of the root folder.

    188490-image.png

    I hope this helps.

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. ComputerHabit 1,031 Reputation points
    2022-03-31T13:30:58.823+00:00

    I guess I'm just annoyed by lack of consistency.

    1 person found this answer helpful.
    0 comments No comments

  2. ComputerHabit 1,031 Reputation points
    2022-06-30T21:44:05.433+00:00

    I just got tripped up by this again. I don't code this often.

    I do not get why the people who develop this would post a URL but make you take a completely different path to get to it.

    1 person found this answer helpful.
    0 comments No comments

  3. Echo Du_MSFT 17,316 Reputation points
    2022-03-31T05:08:33.31+00:00

    Hi @ComputerHabit ,

    According to my research, if you want to get the relative path of the SharePoint list, you need to run this command: $List.RootFolder.ServerRelativeUrl

    For example:

    $Site = "https://domain.sharepoint.com/sites/sitename/"  
    Connect-PnPOnline -Url $Site -Credentials (Get-Credential)  
    $ListUrl = "Lists/listname/"      
    #Get the List  
    $List = Get-PnPList -Identity $ListUrl  
    $List  
    $List.Id  
    $List.Title  
    $List.RootFolder.ServerRelativeUrl  
    

    188578-1.jpg

    Thanks,
    Echo Du

    ===============================================

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.