We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.x
8.0
SharePoint Framework
SPFX 1.20; Node 18.19.1; Typescript 4.7.4.
I've installed PnPJS in my SPFX app according to the example here: https://github.com/pnp/pnpjs/blob/version-4/samples/spfx-react-components/README.md
Then I wanted to get the current user permissions using the documentation here: https://pnp.github.io/pnpjs/sp/permissions/#user-has-permissions
Modules I imported are:
I then try to run a simple function (after initializing _sp), exactly as in the documentation:
const currentUser = await this._sp.web.currentUser(); const isOwner = await this._sp.web.userHasPermissions(currentUser.LoginName, PermissionKind.ManagePermissions);
Here however I get the exception "userHasPermissions is not a function" in the Console, and "undefined" when debugging.
It's clearly not correctly imported. How do I import "userHasPermissions" and "currentUserHasPermissions" in PnP 4.0?
The text was updated successfully, but these errors were encountered:
Hi. It looks like our docs may be missing the import in a couple of the examples.
Make sure to import
import "@pnp/sp/security";
Sorry, something went wrong.
No branches or pull requests
What version of PnPjs library you are using
4.x
Minor Version Number
8.0
Target environment
SharePoint Framework
Additional environment details
SPFX 1.20; Node 18.19.1; Typescript 4.7.4.
Question/Request
I've installed PnPJS in my SPFX app according to the example here:
https://github.com/pnp/pnpjs/blob/version-4/samples/spfx-react-components/README.md
Then I wanted to get the current user permissions using the documentation here:
https://pnp.github.io/pnpjs/sp/permissions/#user-has-permissions
Modules I imported are:
I then try to run a simple function (after initializing _sp), exactly as in the documentation:
Here however I get the exception "userHasPermissions is not a function" in the Console, and "undefined" when debugging.
It's clearly not correctly imported. How do I import "userHasPermissions" and "currentUserHasPermissions" in PnP 4.0?
The text was updated successfully, but these errors were encountered: