sharepoint 2010 목록 항목 필드의 내부 이름을 변경해야합니다. 어떤 이유로 인해 마이 그 레이션 소프트웨어는 2007 년에서 2010 년까지 마이 그 레이션하는 동안 마이 그 레이션 소프트웨어의 이름을 바꾸 었으며이 필드는 다른 프로세스에서 참조하기 때문에 원래 이름으로 내부 이름이 필요합니다. 이 필드는 마이그레이션 된 사이트의 200 개가 넘는 목록에 있으므로 programatically로 수행 할 수있는 방법, 즉 powershell이 필요합니다.Sharepoint 2010 목록 필드에서 internalname을 수정하는 방법
1
A
답변
0
$newInternalName = "yourInternalFieldName"
$displayName = "oldDisplayName"
$SPWebApp = Get-SPWebApplication "http://yourwebapp"
foreach (SPList $currList in $SPWebApp.Lists)
{
foreach (SPField $fld in $currList.Fields) #you could potentially use a different command here to get the field more efficiently
{
if ($fld.Name == $displayName)
{
#The boolean in the parameter list is for required/non-required field $currList.Fields.Add($newInternalName,Microsoft.SharePoint.SPFieldType.Text,$False)
foreach (SPListItem $item in $currList.Items)
{
$item[$newInternalName] = $item[$displayName]
$item[$newInternalName].Title = $displayName #I'm assuming you want to keep the display name the same
$item.Update()
}
Break #since you've already fixed the column for this list no need to keep going through the fields
# optional delete unwanted column
# $currList.Fields.Delete($displayName)
# $currList.Update()
}
}
}
내가 아는 한, 필드가 생성되면 필드의 내부 이름을 변경할 수 없습니다. 여기서 올바른 내부 이름으로 새 필드를 만들고 값을 복사합니다. PowerShell을 사용하여 서버에 액세스 할 필요가 없으므로이를 테스트 할 수 없었지만 필요한 항목과 매우 근접해야합니다. 다른 Add 함수를 사용하고 싶거나 이전 필드를 삭제하려는 경우, 처리 할 필드의 유형에 따라 비트를 약간 조정해야 할 수도 있습니다.
열거 여기에 정의 된 추가 기능의 필드의 유형을 선택합니다 : 추가 기능에 대한 오버로드의 몇 가지가 있습니다 http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.spfieldtype(v=office.14).aspx
그렇다면 내가 당신을 위해 작동하지 않습니다 사용되는, 이 중 하나를 사용하고 싶을 수도 있습니다. http://msdn.microsoft.com/en-us/library/office/aa540133(v=office.14).aspx