Skip to main content

List Teams

Lists all Microsoft Teams teams that the authenticated user is a member of.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.

Input

  • Client Id - The client ID from the Connect node. Optional if using direct credentials.

Output

  • Team - Collection of teams containing:
    • value - Array of team objects
    • Each team has:
      • Id - Unique team identifier
      • DisplayName - Team name
      • Description - Team description
      • IsArchived - Whether team is archived
      • WebUrl - Link to open team in Teams
      • Additional team metadata

Options

  • Credentials - OAuth2 credentials JSON (optional if using Client ID). Allows direct authentication without Connect node.

Examples

List All Teams

Get all teams the user belongs to:

// List Teams node
// Output: team collection

teams_list = team.value

console.log("Found " + teams_list.length + " teams")

for (t of teams_list) {
console.log("Team: " + t.DisplayName)
console.log(" ID: " + t.Id)
console.log(" Archived: " + t.IsArchived)
console.log(" Description: " + t.Description)
}

Find Team by Name

Search for specific team:

// List Teams node
teams = message.team.value

// Find by name
project_team = teams.find(t =>
t.DisplayName === "Project Alpha"
)

if (project_team) {
console.log("Found team: " + project_team.DisplayName)
team_id = project_team.Id
// Use team_id for further operations
} else {
console.log("Team not found")
}

Filter Active Teams

Get only non-archived teams:

// List Teams node
all_teams = message.team.value

// Filter active teams
active_teams = all_teams.filter(t =>
!t.IsArchived
)

console.log("Active teams: " + active_teams.length)
for (team of active_teams) {
console.log("- " + team.DisplayName)
}

Team Selection Menu

Create list for user selection:

// List Teams node
teams = message.team.value

// Create options
team_options = teams.map(t => ({
name: t.DisplayName,
id: t.Id,
description: t.Description
}))

console.log("Available teams:")
team_options.forEach((t, index) => {
console.log((index + 1) + ". " + t.name)
console.log(" " + t.description)
})

// User selects team by number
// selected_team = team_options[selection - 1]

Process All Teams

Perform operation on each team:

// List Teams node
teams = message.team.value

for (team of teams) {
console.log("Processing: " + team.DisplayName)

team_id = team.Id

// List Channels node for this team
// Get team statistics
// Send report message
// etc.

await delay(2000) // Rate limiting
}

Team Statistics

Count and categorize teams:

// List Teams node
teams = message.team.value

total = teams.length
archived = teams.filter(t => t.IsArchived).length
active = total - archived

console.log("Team Statistics:")
console.log(" Total: " + total)
console.log(" Active: " + active)
console.log(" Archived: " + archived)

Tips for Effective Use

  • Cache results: Store team list to avoid repeated API calls
  • Filter archived: Check IsArchived flag for active teams
  • Team selection: Use for letting users choose which team to work with
  • Batch operations: Loop through teams for bulk operations
  • Search by name: Filter teams by DisplayName for specific team
  • Regular refresh: Update team list periodically to catch new teams

Common Errors and Solutions

Empty Team List

Cause: User is not a member of any teams.

Solution:

// List Teams node
teams = message.team.value || []

if (teams.length === 0) {
console.log("User is not a member of any teams")
// Handle accordingly
} else {
// Process teams
}

"ErrNotFound: Client ID not found"

Cause: Invalid or expired client ID from Connect.

Solution:

// Ensure Connect was successful
// Connect node
client_id = message.client_id

if (!client_id) {
throw new Error("Connection failed")
}

// Then use List Teams

Missing Team Information

Cause: Some team fields may be null or undefined.

Solution:

// Safe property access
for (team of teams) {
name = team.DisplayName || "(No name)"
desc = team.Description || "(No description)"
archived = team.IsArchived || false

console.log(name + " - " + desc)
}

Best Practices

  1. Caching: Store team list and refresh periodically
  2. Filtering: Filter by IsArchived for active teams only
  3. Error handling: Handle empty team lists gracefully
  4. User selection: Present teams as choices for user input
  5. Batch processing: Add delays between team operations
  6. Logging: Log team counts for monitoring
  7. Validation: Verify team exists before operations

Output Data Structure

{
"value": [
{
"Id": "19:abc123def456...",
"DisplayName": "Marketing Team",
"Description": "Marketing department collaboration",
"IsArchived": false,
"WebUrl": "https://teams.microsoft.com/l/team/...",
"InternalId": "19:abc123...",
"Classification": null,
"Visibility": "private",
"CreatedDateTime": "2024-01-15T10:00:00Z"
},
{
"Id": "19:xyz789ghi012...",
"DisplayName": "Project Alpha",
"Description": "Customer portal development",
"IsArchived": false,
"WebUrl": "https://teams.microsoft.com/l/team/...",
"InternalId": "19:xyz789...",
"Classification": null,
"Visibility": "private",
"CreatedDateTime": "2024-06-20T14:30:00Z"
}
]
}