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

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

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"  

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

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.