Skip to content
New issue

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

Enumerating sensitivity labels with application permissions uses wrong endpoint #882

Closed
mortenostigard opened this issue Jun 17, 2022 · 2 comments
Assignees
Labels
area:admin 📜 Admin library related bug Something isn't working

Comments

@mortenostigard
Copy link

mortenostigard commented Jun 17, 2022

Describe the bug

Enumerating sensitivity labels using application permissions tries to access me/informationprotection/policy/labels endpoint -resulting in an error.

I'm able to get the labels from the Graph API by executing a custom query, so I have the appropriate permissions for my app registration. I have verified that I'm using application permission as await context.GetMicrosoft365Admin().AccessTokenUsesApplicationPermissionsAsync() returns true (and I have not configured delegate permissions anyways).

Steps to reproduce

Run
var labels = await context.GetMicrosoft365Admin().GetSensitivityLabelsAsync();

with application permissions.

Environment details (development & target environment)

SDK version: 1.6.76-nightly
OS: Windows 11
SDK used in: .NET
Framework: .NET 6
Browser(s): N/A
Tooling: N/A
Additional details:

@jansenbe jansenbe self-assigned this Jun 17, 2022
@jansenbe jansenbe added area:admin 📜 Admin library related bug Something isn't working labels Jun 17, 2022
@jansenbe
Copy link
Contributor

@mortenostigard : what query are you using for app-only label retrieval?

@jansenbe
Copy link
Contributor

@mortenostigard : never mind, found the bug and fixed it. There was a method SensitivityLabelManager.GetLabelsAsync that checked for the permission type and called the application or delegated variant. This method was however not called from the end point, we hardcoded called the delegated one.

This is fixed now and changes will appear in the next nightly build (version 1.6.81 or higher).

Thanks for using PnP Core SDK and providing the feedback.

Closing this now, feel free to re-open if you still face issues with the updated build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:admin 📜 Admin library related bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants