I have to functions. In the first, I create a reference to a SharePoint list. I would like to pass the list to a second function. In the second functions list of parameters, I declare it as String
This doesn't work. How do I declare the parameter as being a list?
function GetList()
{
param(
[string] $listID,
[string] $listName
)
Write-Host "Provided ListName: " $listName -ForegroundColor Cyan
Write-Host "The list id is: " $listID -ForegroundColor Red
$list = Get-PnPList -Identity $listName
CreateView -list $list
}
function CreateView()
{
param(
[string] $list
)
Add-PnpView -Title "Test View" -List $list -Fields "Title"
Write-Host "Creating New View"
}