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()

}
0

1 Answer 1

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 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.