Skip to content

Commit c274294

Browse files
authored
Merge pull request #1210 from SherpasGroup/fix-teams-tab-provisioning
Increase retry delay and improve error handling in GetTabs
2 parents ba09446 + d93c971 commit c274294

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectTeams.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ private static void RemoveTeamTab(string tabId, string channelId, string teamId,
11801180
public static JToken GetExistingTeamChannelTabs(string teamId, string channelId, string accessToken, Uri graphBaseUri = null)
11811181
{
11821182
const int maxRetryCount = 60;
1183-
const int retryDelay = 1000;
1183+
const int retryDelay = 5000; // Increased to 5 seconds
11841184
var retryAttempt = 0;
11851185

11861186
JToken response = null;
@@ -1198,7 +1198,9 @@ public static JToken GetExistingTeamChannelTabs(string teamId, string channelId,
11981198
}
11991199
catch (Exception ex)
12001200
{
1201-
if (ex.InnerException != null && ex.InnerException.Message.Contains("No active channel found with channel id:"))
1201+
// Check both inner exception and the main exception message for channel not found errors
1202+
var exceptionMessage = ex.Message + (ex.InnerException?.Message ?? "");
1203+
if (exceptionMessage.Contains("No active channel found"))
12021204
{
12031205
Thread.Sleep(retryDelay);
12041206
}
@@ -1214,6 +1216,11 @@ public static JToken GetExistingTeamChannelTabs(string teamId, string channelId,
12141216
}
12151217
} while (response == null && retryAttempt <= maxRetryCount);
12161218

1219+
if (response == null)
1220+
{
1221+
throw new Exception($"Could not get tabs for channel {channelId} in team {teamId} within timeout.");
1222+
}
1223+
12171224
return response;
12181225
}
12191226

0 commit comments

Comments
 (0)