1

I want to create a term set using powershell, and i need to pass the term set GUID, as i want to create a copy of our staging term sets inside our live server, so i can export/import managed metadata columns between the 2 farms without any problem. now i find this link which mention how i can create term set using power-shell and pass the term-set name & GUID Link. but when i try to do so using this power-shell script:-

PS C:\Users\spadmin.srv> $termGroup = $termstore.groups["Category"];
PS C:\Users\spadmin.srv> $termSet = $termGroup.CreateTermSet("Customers","af5276
41-**********-5084c17f5ee3")

i got the following exception:-

Cannot convert argument "lcid", with value:
"af5276
41-**********-5084c17f5ee3", for "CreateTermSet" to type
"System.Int32": "Cannot convert value "af5276
41-**********-5084c17f5ee3"
to type "System.Int32". Error: "Input string was not in a correct format.""
At line:1 char:1
+ $termSet =
$termGroup.CreateTermSet("Customers","af5276
41-**********-5084c17f5ee3 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

so can anyone adivce how i can fix this problem? second question. now let say i manage to create the term sets by passing their GUIDs (similar GUIDs which are defined inside our staging server).. so could this cause any problem in the future insdie our live server, if for example i create new term sets using UI,, and the system generate a GUID which already exists.. or this case will never happen??

0

John,

Your error is for lcid

Cannot convert argument "lcid"

lcid for english is 1033

Example

#Create a term with GUID (change this GUID to yours)
$term = $termSet.CreateTerm("new term name",1033,"96625F47-4C74-48C8-B852-A91102ADEEBB")
$termStore.CommitAll()

Try with this

$termSet = $termGroup.CreateTermSet("Customers",1033,"af527641-**********-5084c17f5ee3")

or this

$termSet = $termGroup.CreateTermSet("Customers",[System.Guid]("af527641-**********-5084c17f5ee3"))

:)

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.