Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

Cannot find an overload for LOAD and the argument count: 1

$
0
0

I have a PowerShell script that I am trying to use to create terms that are listed in a text document. This is what my script looks like currently....

#Specify tenant admin and URL
$User = myuser@mycorp.onmicrosoft.com
$Password = "mypassword"
$Site = "https://mycorp.sharepoint.com/sites/SampleSite"
$GroupName = "Group Name"
$TermSetName = "Term Set"
$Terms = Get-Content "C:\test\terms.txt"

#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
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"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll"
#$Password = Read-Host -Prompt "Please enter your password" -AsSecureString

#Bind to MMS
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds
$MMS = [Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Context)
$Context.Load($MMS)
$Context.ExecuteQuery()

#Retrieve Term Stores
$TermStores = $MMS.TermStores
$Context.Load($TermStores)
$Context.ExecuteQuery()

#Bind to Term Store
$TermStore = $TermStores[0]
$Context.Load($TermStore)
$Context.ExecuteQuery()

#Bind to Group
$Group = $TermStore.Groups.GetByName($GroupName)
$Context.Load($Group)
$Context.ExecuteQuery()

#Bind to Term Set
$TermSet = $Group.TermSets.GetByName($TermSetName)
$Context.Load($TermSet)
$Context.ExecuteQuery()

#Create Terms
Foreach ($Term in $Terms)
{
  $TermAdd = $TermSet.CreateTerm($Term,1033,[System.Guid]::NewGuid().toString())
  $Context.Load($TermAdd)
  $Context.ExecuteQuery()
}


When I run my script, I am currently getting an error that states that "Cannot find an overload for LOAD and the argument count: 1".

What am I doing wrong here? I really appreciate the help. Thanks



Viewing all articles
Browse latest Browse all 10096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>