1

I want to copy the single managed metadata Field [Base currency] Value.

$newItem["Base Currency"] = $item["Base currency"] it's wrong because it's a managed metadata.. we don't get the value of managed metadata as a single line of text

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 
 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) { Add-PSSnapin Microsoft.SharePoint.Powershell }

$web = Get-SPWeb http://intranet/
$listProspect = $web.Lists["Prospects"]


$Fund = Get-SPWeb http://intranet/cccc
$listFunds = $Fund.Lists["New Fund"]


foreach($item in $listProspect.Items | Where {$_["Approved"] -eq 
"string;#Approved"}) 
#Approved is a calculated Column so it's input have the value string;#..

{
    $newItem = $listFunds.Items.Add();

    $newItem["Title"] = $item["Client's Name"]
    **$newItem["Base Currency"] = $item["Base currency"]**

    $newItem.Update()

}
1

This is the solution :

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 
'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) { Add-PSSnapin Microsoft.SharePoint.Powershell }

$web = Get-SPWeb http://intranet/
$listProspect = $web.Lists["Prospects"]


$Fund = Get-SPWeb http://intranet/cccc
$listFunds = $Fund.Lists["New Fund"]


foreach($item in $listProspect.Items | Where {$_["Approved"] -eq 
"string;#Approved"}) 
#Approved is a calculated Column so it's input have the value string;#..

{
$newItem = $listFunds.Items.Add();

$newItem["Title"] = $item["Client's Name"]


        $CurrencyFieldValue = $item["Base currency"] -as 
        [Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue];            

    $CurrencyFieldValue.TermGuid; 

    $newItem["Base Currency"] = $CurrencyFieldValue.TermGuid;

$newItem.Update()

}

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.