powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Cannot retrieve M365 Groups with Apostrophes/Single Quotes in DisplayName or MailNickname

Open danielcecil opened this issue 1 year ago • 0 comments

Reporting an Issue or Missing Feature

Issue similar to #3569 but for M365 Groups Related function / line: https://github.com/pnp/powershell/blob/1f35dbce9409863ef3fac321f3216a7c8543e9d1/src/Commands/Utilities/Microsoft365GroupsUtility.cs#L147

Expected behavior

When a Group has an Apostrophe (') in the DisplayName or MailNickname the Group should return.

The fix is to escape the DisplayName or Mailnickname with double apostrophes '' E.g. MyManager'sTeam becomes MyManager''sTeam

Actual behavior

Error Message: Get-PnPMicrosoft365GroupOwner: Bad Request (400): Invalid filter clause: ')' or operator expected at position 76 in 'groupTypes/any(c:c eq 'Unified') and (displayName eq 'MyManager'sTeam' or mailNickName eq 'MyManager'sTeam')'

Steps to reproduce behavior

Create a M365 Group or Team with an apostrophe in the title and run for example: Get-PnPMicrosoft365Group -Identity "MyManager'sTeam"

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

2.5.0

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

  • [X] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

danielcecil avatar Aug 19 '24 10:08 danielcecil