0

In PowerShell CSOM for SharePoint 2013 site, How to check if "Variation Labels" list is exists or not?

3
  • what is variation list? if you setup variations, so where they are saved? have you any screenshot of this list? Commented Feb 26, 2019 at 10:27
  • i want script to check for any list whether that exists or not. not specific to "variation labels" list only. Commented Feb 26, 2019 at 11:32
  • @ZdeněkVinduška i meant to say "varation Labels" list. Commented Feb 26, 2019 at 12:43

1 Answer 1

2

The following PowerShell with CSOM for your reference.

Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"  
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"  

$siteURL = "http://sp2013/sites/team"  
$username="admin"
$password="xx"
$domain="contoso"

$creds = New-Object System.Net.NetworkCredential($username, $password, $domain);
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)  
$ctx.credentials = $creds  
try{  
    $rootWeb = $ctx.Site.RootWeb
    $varLabelsList = $rootWeb.Lists.GetByTitle("Variation Labels")
    $ctx.Load($varLabelsList)
    $ctx.ExecuteQuery()
    write-host "The Variation Labels list exists." -foregroundcolor green 
}  
catch{  
    write-host "The Variation Labels list not exists." -foregroundcolor red
}  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.