question

ComputerHabit-1849 avatar image
0 Votes"
ComputerHabit-1849 asked ComputerHabit-1849 answered

Get PNP List and NO URL!!!!


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

188572-image.png


office-sharepoint-onlinesharepoint-devoffice-sharepoint-server-itpro
image.png (23.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RobWindsor-4651 avatar image
0 Votes"
RobWindsor-4651 answered

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.



image.png (22.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EchoDu-MSFT avatar image
0 Votes"
EchoDu-MSFT answered RobWindsor-4651 commented

Hi @computerhabit-1849 ,

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.




1.jpg (86.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@EchoDu-MSFT Next time you can just copy and paste my answer. It will save you some time.

0 Votes 0 ·
ComputerHabit-1849 avatar image
0 Votes"
ComputerHabit-1849 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ComputerHabit-1849 avatar image
0 Votes"
ComputerHabit-1849 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.