Skip to main content
Edited to use Mike Smiths example
Source Link
jAC
  • 217
  • 1
  • 4
  • 10

Edited to use Mike Smith's solution.

I was able to get this to work by doing the following adjustment (adding string to the variable)

$RootFolder = '/Path/To/Folder'

$folders = Get-PnPFolderItem -FolderSiteRelativeUrl $RootFolder

foreach ($folder in $folders){
    [string] $folderName = $folder.Name
    $user = Get-PnPUser | Where Title -Like "*$folderName*""*$($folder.Name)*"}
}

I was able to get this to work by doing the following adjustment (adding string to the variable)

$RootFolder = '/Path/To/Folder'

$folders = Get-PnPFolderItem -FolderSiteRelativeUrl $RootFolder

foreach ($folder in $folders){
    [string] $folderName = $folder.Name
    $user = Get-PnPUser | Where Title -Like "*$folderName*"}
}

Edited to use Mike Smith's solution.

I was able to get this to work by doing the following adjustment (adding string to the variable)

$RootFolder = '/Path/To/Folder'

$folders = Get-PnPFolderItem -FolderSiteRelativeUrl $RootFolder

foreach ($folder in $folders){
    $user = Get-PnPUser | Where Title -Like "*$($folder.Name)*"}
}
Source Link
jAC
  • 217
  • 1
  • 4
  • 10

I was able to get this to work by doing the following adjustment (adding string to the variable)

$RootFolder = '/Path/To/Folder'

$folders = Get-PnPFolderItem -FolderSiteRelativeUrl $RootFolder

foreach ($folder in $folders){
    [string] $folderName = $folder.Name
    $user = Get-PnPUser | Where Title -Like "*$folderName*"}
}