Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions src/lib/PnP.Framework/Graph/UnifiedGroupsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,24 +252,31 @@ public static UnifiedGroupEntity CreateUnifiedGroup(string displayName, string d

int driveRetryCount = retryCount;

while (driveRetryCount > 0 && string.IsNullOrEmpty(modernSiteUrl))
if (addedGroup.AdditionalData?.TryGetValue("id", out var groupId) == true)
{
try
{
modernSiteUrl = GetUnifiedGroupSiteUrl(addedGroup.GroupId, accessToken, azureEnvironment: azureEnvironment);
}
catch
while (driveRetryCount > 0 && string.IsNullOrEmpty(modernSiteUrl))
{
// Skip any exception and simply retry
}
try
{
modernSiteUrl = GetUnifiedGroupSiteUrl(groupId.ToString(), accessToken, azureEnvironment: azureEnvironment);
}
catch
{
// Skip any exception and simply retry
}

// In case of failure retry up to 10 times, with 500ms delay in between
if (string.IsNullOrEmpty(modernSiteUrl))
{
Task.Delay(delay * (retryCount - driveRetryCount)).GetAwaiter().GetResult();
driveRetryCount--;
// In case of failure retry up to 10 times, with 500ms delay in between
if (string.IsNullOrEmpty(modernSiteUrl))
{
Task.Delay(delay * (retryCount - driveRetryCount)).GetAwaiter().GetResult();
driveRetryCount--;
}
}
}
else
{
throw new Exception("Could not find the group id in the additional data returned from the Graph when creating the unified group");
}

group.SiteUrl = modernSiteUrl;
}
Expand Down
Loading