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

[BUG] Remove-PnPTeamsChannelUser - weird error return #4727

Open
1 task
toucan2297 opened this issue Feb 6, 2025 · 3 comments
Open
1 task

[BUG] Remove-PnPTeamsChannelUser - weird error return #4727

toucan2297 opened this issue Feb 6, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@toucan2297
Copy link

Notice

Reporting an Issue or Missing Feature

When using the command, i've notices a weird error return :

Image

$team.DisplayName = 'RBPO Coordination protection de l'enfance / pédopsychiatrie'
$userEmail = 'c.vincent@h***********m'
$privateTeamChannel.DisplayName = 'Recherche documentaire - analyse de la littérature'

COMMAND ISSUED :
Remove-PnPTeamsChannelUser -Identity $userEmail -Channel $privateTeamChannel.DisplayName -Team $team.DisplayName -Force

Expected behavior

I expect removing the user from the TEAMS private channel

Actual behavior

Bad request (400): Invalid filter clause: ')' or operator expected at position 103 in '(resourceProvisioningOptions/Any(x:x eq 'Team') and mailNickname eq 'RBPO Coordination protection de l'enfance / pédopsychiatrie')'.

the caracter chain looks like a graph request
i've iterated on 1082 TEAMS to process a user supprssion and it works pretty OK, but i've found 2 use cases where terminal retruned that error; i really don't think it comes from my script, pretty sure there's something wrong in the command and it reaches a block where it goes wrong (maybe special chars)

Steps to reproduce behavior

Remove-PnPTeamsChannelUser -Identity $userEmail -Channel $privateTeamChannel.DisplayName -Team $team.DisplayName -Force

What is the version of the Cmdlet module you are running?

2.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
@toucan2297 toucan2297 added the bug Something isn't working label Feb 6, 2025
@jackpoz
Copy link
Contributor

jackpoz commented Feb 7, 2025

This seems to be caused by the ' character in $team.DisplayName

@toucan2297
Copy link
Author

This seems to be caused by the ' character in $team.DisplayName

I understand the issue comes from a bad char in the team name, which is badly escaped when passed to graph API request, then i think the issue is not on the PnP user side (me), because at this point we would need to avoid using bad chars when naming teams or m365 groups or sharepoint sites, this bug report is not intended to be a criticism, PnP is great and help me so much, i sent this report to improve the command and put the finger on a use case that is not actually handled by the function code

@jackpoz
Copy link
Contributor

jackpoz commented Feb 7, 2025

Oh my comment was to help you workaround the issue until it gets properly fixed, bug reports are always welcome 😃

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

No branches or pull requests

2 participants