Skip to content

Commit

Permalink
Merge pull request #917 from SherpasGroup/peoplepicker-groupid
Browse files Browse the repository at this point in the history
Added
  • Loading branch information
AJIXuMuK committed Jun 8, 2021
2 parents 6f603bd + a052ae2 commit 6aba4b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/documentation/docs/controls/PeoplePicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ The People picker control can be configured with the following properties:
| ---- | ---- | ---- | ---- | ---- |
| context | BaseComponentContext | yes | Context of the current web part. | |
| titleText | string | no | Text to be displayed on the control | |
| groupName | string | no | group from which users are fetched. Leave it blank if need to filter all users | _none_ |
| groupName | string | no | Group from which users are fetched. Leave it blank if need to filter all users. When both groupName and groupId specified groupName takes precedence. | _none_ |
| groupId | number | no | Group from which users are fetched. Leave it blank if need to filter all users. When both groupId and groupName specified groupName takes precedence. | _none_ |
| personSelectionLimit | number | no | Defines the limit of people that can be selected in the control | 1 |
| required | boolean | no | Set if the control is required or not | false |
| disabled | boolean | no | Set if the control is disabled or not | false |
Expand Down
4 changes: 4 additions & 0 deletions src/controls/peoplepicker/IPeoplePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export interface IPeoplePickerProps {
*/
groupName?: string;
/**
* Id of SharePoint Group
*/
groupId?: number;
/**
* Maximum number of suggestions to show in the full suggestion list. (default: 5)
*/
suggestionsLimit?: number;
Expand Down
4 changes: 3 additions & 1 deletion src/controls/peoplepicker/PeoplePickerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
* Get initial persons
*/
private async getInitialPersons(props: IPeoplePickerProps) {
const { groupName, webAbsoluteUrl, defaultSelectedUsers, ensureUser, principalTypes } = props;
const { groupName, groupId, webAbsoluteUrl, defaultSelectedUsers, ensureUser, principalTypes } = props;
// Check if a group property was provided, and get the group ID
if (groupName) {
this.groupId = await this.peopleSearchService.getGroupId(groupName, webAbsoluteUrl);
Expand All @@ -85,6 +85,8 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
});
return;
}
} else if (groupId) {
this.groupId = groupId;
} else {
this.groupId = null;
}
Expand Down

0 comments on commit 6aba4b8

Please sign in to comment.