2013-08-08 7 views
1

내가 수행하여 기존 목록에 필드를 추가 해요을 ...- 파워 쉘

$spList.Fields.Add(
    "SourceManager", 
    [Microsoft.SharePoint.SPFieldType]::User, 
    $false 
) 

$spList.Fields["SourceManager"].Indexed = $true; 
$spList.Fields["SourceManager"].EnforceUniqueValues = $true; 
$spList.Fields["SourceManager"].Required = $true; 
$spList.Fields["SourceManager"].Update(); 

이 괜찮지 만, 나는 또한 필드를 설정하려는 경우에만 사람들을 허용하십시오 (여기서는 기본 동작이 아닌 & 그룹입니다). 설정을 찾을 수 없습니다.

누구나 올바른 방향으로 나를 가리킬 수 있습니까?

답변

1

업데이트하기 전에 필드의 선택 모드를 설정하십시오. 두 가지 옵션은 다음과 같습니다.

$spList.Fields.Add(
    "SourceManager", 
    [Microsoft.SharePoint.SPFieldType]::User, 
    $false 
) 

$spList.Fields["SourceManager"].Indexed = $true; 
$spList.Fields["SourceManager"].EnforceUniqueValues = $true; 
$spList.Fields["SourceManager"].Required = $true; 

$spList.Fields["SourceManager"].SelectionMode = [Microsoft.SharePoint.SPFieldUserSelectionMode]::PeopleAndGroups; # For people and groups. 
$spList.Fields["SourceManager"].SelectionMode = [Microsoft.SharePoint.SPFieldUserSelectionMode]::PeopleOnly; # For people only. 


$spList.Fields["SourceManager"].Update();