sp-dev-fx-controls-react icon indicating copy to clipboard operation
sp-dev-fx-controls-react copied to clipboard

PeoplePicker Group could not be found.

Open Ofer-Gal opened this issue 1 year ago • 1 comments

Category

[X] Bug ?

Version

Please specify what version of the library you are using: ["@pnp/spfx-controls-react": "^3.18.1" ]

Expected / Desired Behavior / Question

My 365 group "DPC Department" is a valid group so I should use:

	<PeoplePicker 
		    context={context as any} 
		    personSelectionLimit={1}
		    groupName={"DPC Department"} 
		    showtooltip={true}                
		    onChange={getPeoplePickerItems} 
		    principalTypes={[PrincipalType.User]}
		    resolveDelay={2000} 
	/>

Observed Behavior

the control is disabled and shows "Group could not be found." I also tried the Guid of the group and the SharePoint group. got same results

Steps to Reproduce

Use code like above.

not sure if related, but Typescript did not like peoplePickerContext for PeoplePicker context so I used context={context as any} //from props

image

Thanks!

Ofer-Gal avatar Jul 13 '24 10:07 Ofer-Gal

Seems like a compatibility issue: I described it here.

EA12 avatar Aug 07 '24 12:08 EA12

Hi @Ofer-Gal,

Do you still have compatibility issues? I tried with latest version (3.20.0) and a SPFx solution (1.20.0) without trouble.

michaelmaillot avatar Jan 29 '25 18:01 michaelmaillot

All is good, Thanks

Ofer-Gal avatar Jan 30 '25 07:01 Ofer-Gal

I am getting the same error message now with SharePoint version "1.21.1" and "@pnp/spfx-controls-react": "^3.22.0"

import { PeoplePicker, PrincipalType } from "@pnp/spfx-controls-react/lib/PeoplePicker";

<PeoplePicker context={props.context as any} titleText="" defaultSelectedUsers={ props.DATA.PDBClerk ? [props.DATA.PDBClerk.DisplayName] : []} personSelectionLimit={1} groupName={GroupNames.Sachbearbeiter} showtooltip={true} styles={ppStyle} disabled={!props.DATA.IsClerk} onChange={_clerkChanged} principalTypes={[PrincipalType.User]} resolveDelay={1000} />

Image

Previously it was working with 1.19.0 and 3.8.1 After I upgraded my project to 1.21.1 and 3.22.0, we are getting this issue now and must revert back as this is in production and people cannot work!

Could you deliver a hotfix?

From https://www.npmjs.com/package/@pnp/spfx-controls-react/v/3.22.0?activeTab=code and your package.json this version supports node 22.14.0 < 23.0.0:

"name": "@pnp/spfx-controls-react", "description": "Reusable React controls for SharePoint Framework solutions", "version": "3.22.0", "engines": { "node": ">=22.14.0 < 23.0.0" }

if we install that version (having node 22.18.0), we see this: "node_modules/@pnp/spfx-controls-react": { "version": "3.22.0", "resolved": "https://registry.npmjs.org/@pnp/spfx-controls-react/-/spfx-controls-react-3.22.0.tgz",

and find this dependency: "@microsoft/mgt-spfx": "3.1.3" which supports only node <19.0.0:

"node_modules/@microsoft/mgt-spfx": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/@microsoft/mgt-spfx/-/mgt-spfx-3.1.3.tgz", "integrity": "sha512-3lg2sBiN38+yn4J/+3FHEO0qYs5Rzu/5eswyHGgo6BMyLbO4ILr9E6+ULs8FhIoAw0qGV6+GxicCkyFlAVhhJA==", "license": "MIT", "dependencies": { "@microsoft/mgt-components": "3.1.3", "@microsoft/mgt-element": "3.1.3", "@microsoft/mgt-sharepoint-provider": "3.1.3", "tslib": "2.3.1" }, "engines": { "node": ">=16.13.0 <17.0.0 || >=18.17.1 <19.0.0" } }

If I want to use an earlier version of @pnp/spfx-controls-react, it does not support node higher that 19.0.0

Since the beginning of computing we run into the dll-Hell, now we also live in the Dependency-Hell. Anybody able to fix this?

EA12 avatar Sep 19 '25 07:09 EA12

I have downgraded my project to sp 1.19.0 with node 18.19.0 and @pnp/spfx-controls-react": "^3.18.1" I get: Group cannot be found.

When i debug your code, i can see that this.context.AbsolutUrl is undefind, hence the error:

Image

in method searchTenant.

this then is a call with a wrong constructed url:

Image

which at least raises the error here:

Image

So, it seems that the root cause is that this.context.AbsolutUrl is undefined

EA12 avatar Sep 19 '25 15:09 EA12

Dear @michaelmaillot : Could you please have a look into it?

EA12 avatar Sep 19 '25 15:09 EA12

Version 3.19.0 has a valid context but we are not using the PeoplePicker anymore to support the selection of users from a specific group, we are using a dropdown now as we could not wait for a fix regarding groupName.

EA12 avatar Sep 22 '25 07:09 EA12