Skip to content

Commit

Permalink
Fix #4169 : issue with single quote in Group display names (#4291)
Browse files Browse the repository at this point in the history
Co-authored-by: Gautam Sheth <[email protected]>
  • Loading branch information
gautamdsheth and Gautam Sheth authored Sep 15, 2024
1 parent 94e37e2 commit efa1090
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Commands/Utilities/Microsoft365GroupsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using PnP.PowerShell.Commands.Base;
using System.Management.Automation;
using System.Threading;
using System.Net;

namespace PnP.PowerShell.Commands.Utilities
{
Expand Down Expand Up @@ -144,6 +145,7 @@ internal static Microsoft365Group GetGroup(Cmdlet cmdlet, PnPConnection connecti

internal static Microsoft365Group GetGroup(Cmdlet cmdlet, PnPConnection connection, string displayName, string accessToken, bool includeSiteUrl, bool includeOwners, bool detailed, bool includeSensitivityLabels)
{
displayName = WebUtility.UrlEncode(displayName.Replace("'", "''"));
var results = GraphHelper.Get<RestResultCollection<Microsoft365Group>>(cmdlet, connection, $"v1.0/groups?$filter=groupTypes/any(c:c+eq+'Unified') and (displayName eq '{displayName}' or mailNickName eq '{displayName}')", accessToken);
if (results != null && results.Items.Any())
{
Expand Down

0 comments on commit efa1090

Please sign in to comment.