I'm using PnP Powershell (which I'm new to) and I wish to find the URL of a document in a document library. The following returns Microsoft.SharePoint.Client.ObjectPathIdentity rather than an actual value. Here's my code:
$url = "https://tenant.sharepoint.com/teams/test"
Connect-PnPOnline –Url $url –Credentials (Get-Credential $userCredential)
$web = Get-PnPWeb
$ctx = Get-PnPContext
$libs = Get-PnPList | Where{$_.BaseTemplate -eq 101}
foreach($lib in $libs)
{
$libitems = Get-PnPListItem -List $lib -Fields "FileLeafRef"
foreach($libitem in $libitems)
{
if({$_.Name -match ".doc*"})
{
write-host "lib path... "$libitem.Path
}
}
}
The output is:
lib path... Microsoft.SharePoint.Client.ObjectPathIdentity followed by the Id, Title and Unique Id of all library items in the library.
Any thoughts? I was expecting the Path of the list item to be returned.