Skip to content

Commit

Permalink
Merge branch 'patch-11' of https://github.com/magarma/pnpframework in…
Browse files Browse the repository at this point in the history
…to pr933
  • Loading branch information
jansenbe committed Oct 26, 2023
2 parents 47d1fe9 + 9bcf1ea commit c10b680
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/PnP.Framework/Sites/SiteCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,9 @@ public static async Task<bool> AliasExistsAsync(ClientContext context, string al
var httpClient = PnPHttpClient.Instance.GetHttpClient(context);
#pragma warning restore CA2000 // Dispose objects before losing scope

// Escape single quotes, for instance, when the alias is something like "What's new", it should be escaped to "What''s new"
alias = alias.Replace("'", "''");

string requestUrl = string.Format("{0}/_api/SP.Directory.DirectorySession/Group(alias='{1}')", context.Web.Url, alias);
using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl))
{
Expand Down Expand Up @@ -1152,6 +1155,9 @@ public static async Task<Dictionary<string, string>> GetGroupInfoAsync(ClientCon
var httpClient = PnPHttpClient.Instance.GetHttpClient(context);
#pragma warning restore CA2000 // Dispose objects before losing scope

// Escape single quotes, for instance, when the alias is something like "What's new", it should be escaped to "What''s new"
alias = alias.Replace("'", "''");

string requestUrl = string.Format("{0}/_api/SP.Directory.DirectorySession/Group(alias='{1}')", context.Web.Url, alias);
using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl))
{
Expand Down

0 comments on commit c10b680

Please sign in to comment.