I've written a bit of powershell for creating a list just wondering how add say an if statement to check if its already been created. In Client side not server side here is my code :



$context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$context.Credentials = $credentials
$web = $context.Web 

$ListInfo = New-Object Microsoft.SharePoint.Client.ListCreationInformation
$ListInfo.Title = $ListTitle
$ListInfo.TemplateType = "100"
$myList = $web.Lists.Add($ListInfo)
$myList.Description = $ListTitle
$list1 = $web.Lists | where{$_.Title -eq $listName1}if($list1){// Execute if list exists}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.