SharePoint 2010의 "선택 메타 데이터"열로 "선택"열을 변환하려고합니다.
-
10-12-2019 - |
문제
Choice "(Checkbox (여러 선택 가능) 열이 있으며 열을 데이터 손실없이"관리되는 메타 데이터 "열로 변환하고자합니다. 제안.
해결책 2
관리되는 메타 데이터 필드 업데이트 -> multivalue (multivalue 허용)
○ Create a local term group, set, terms, term
○ Ref - http://social.msdn.microsoft.com/Forums/hu/sharepointdevelopmentprevious/thread/75ae3a89-7d28-41d9-b58c-56d4f7e9771d
$site = Get-SPSite "SiteURL"
$session = New-Object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
$web = $site.openWeb() ;
$termStore = $session.TermStores["Enterprise Metadata Service Proxy"];
$group = $termStore.Groups["GroupName"];
$termSet = $group.TermSets["TermSet"];
$terms = $termSet.Terms;
$list = $web.Lists["ListName"];
$list.Items |% {
$spItem = $_;
write-host "Updating the Item - $($_.Id)";
#Get the taxonomy field for the list item
$taxField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$spItem.Fields["TaxField"]
#Create a term collection
$termCollection = new-object Microsoft.SharePoint.Taxonomy.TaxonomyFieldValueCollection($taxField);
$termName = $spItem["ChoiceField"].ToString() -replace ";#",",";
foreach($indTerm in $termName.Split(","))
{
if($indTerm.Length -gt 0)
{
#Get each individual term.
$term = $terms | where {$_.Name -eq $indTerm}
#Creating a field value that represents one term
$taxonomyFieldValue = new-object Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue($taxField)
$taxonomyFieldValue.TermGuid = $term.Id
$taxonomyFieldValue.Label = $term.Name
#Add term to collection.
$termCollection.Add($taxonomyFieldValue)
}
}
#Adding the Term Collection to the column.
$taxField.SetFieldValue($spItem, $termCollection);
$spItem.SystemUpdate();
}
$web.Close();
$site.Dispose();
. 다른 팁
내 경험에서 이것은 프로그래밍 방식으로 수행되어야합니다. 새 관리되는 메타 데이터 열을 수동으로 추가 한 다음 콘솔 앱이나 PowerShell을 작성하여 항목 / 문서를 ThrHough를 루프하고 선택한 값을 관리되는 메타 데이터와 동일한 값과 일치시킵니다.그런 다음 항목의 SystemUpdate (false)를 수행하십시오 (false 부분은 버전이 증가되지 않도록 방지)
희망이 도움이
제휴하지 않습니다 sharepoint.stackexchange