Skip to main content

Get Group

Retrieves detailed information about a specific group from Azure Active Directory.

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.

Inputs

  • Access Id - The access ID from the Connect node. Optional if using direct credentials.
  • Group Object Id - Group object ID (unique identifier) of the group to retrieve. Example: 12345678-1234-1234-1234-123456789012

Options

Direct Credentials (optional - alternative to using Connect node):

  • Tenant Id - Azure AD tenant ID (optional if using Access ID)
  • Client Id - Azure AD application client ID (optional if using Access ID)
  • Client Secret - Azure AD application client secret credential (optional if using Access ID)

Output

  • Result - Group object containing detailed group information including:
    • id - Group's unique object ID
    • displayName - Group's display name
    • description - Group description
    • mailNickname - Email nickname
    • mail - Email address (if mail-enabled)
    • groupTypes - Array of group types (e.g., ["Unified"])
    • mailEnabled - Whether group is mail-enabled
    • securityEnabled - Whether group is security-enabled
    • createdDateTime - When the group was created
    • And other group properties

How It Works

The Get Group node:

  1. Authenticates using either the access ID or direct credentials
  2. Sends a GET request to Microsoft Graph API for the specified group
  3. Returns the complete group object with all properties
  4. Requires the group's object ID (not display name)

Examples

Get Group Information

Retrieve group details by object ID:

// Using Connect node
access_id = message.access_id
group_object_id = "12345678-1234-1234-1234-123456789012"

// Get Group node executes

// Output
result = {
"id": "12345678-1234-1234-1234-123456789012",
"displayName": "Engineering Team",
"description": "Engineering department security group",
"mailNickname": "engineering",
"groupTypes": [],
"mailEnabled": false,
"securityEnabled": true,
"createdDateTime": "2024-01-15T10:30:00Z",
...
}

Identify Group Type

Determine what type of group it is:

// Get Group node
group_object_id = "12345678-1234-1234-1234-123456789012"

// Check group type
if (result.groupTypes.includes("Unified")) {
console.log("This is a Microsoft 365 Group")
} else if (result.securityEnabled && !result.mailEnabled) {
console.log("This is a Security Group")
} else if (result.mailEnabled && !result.securityEnabled) {
console.log("This is a Distribution Group")
} else if (result.mailEnabled && result.securityEnabled) {
console.log("This is a Mail-enabled Security Group")
}

Verify Group Before Operations

Check if group exists before performing operations:

try {
// Get Group node
group_object_id = "12345678-1234-1234-1234-123456789012"

// Group exists, can proceed
console.log("Found group: " + result.displayName)

// Add User To Group node
// Group Object Id: group_object_id
// User Id: "user@contoso.onmicrosoft.com"

} catch (error) {
console.log("Group not found")
// Create Group node or handle error
}

Extract Group Properties

Get specific group information:

// Get Group node
group_object_id = "12345678-1234-1234-1234-123456789012"

// Extract properties
group_info = {
name: result.displayName,
email: result.mail || "N/A",
type: result.securityEnabled ? "Security" : "Distribution",
created: result.createdDateTime
}

console.log("Group: " + group_info.name)
console.log("Type: " + group_info.type)

Bulk Group Information Retrieval

Get information for multiple groups:

// List of group IDs
group_ids = [
"12345678-1234-1234-1234-123456789012",
"abcdef12-3456-7890-abcd-ef1234567890",
"fedcba98-7654-3210-fedc-ba9876543210"
]

group_details = []

// Loop through groups
for (group_id of group_ids) {
try {
// Get Group node
// Group Object Id: group_id

// Store group info
group_details.push({
id: result.id,
name: result.displayName,
description: result.description,
type: result.securityEnabled ? "Security" : "Distribution"
})
} catch (error) {
console.log("Group not found: " + group_id)
}
}

Check Group Email Settings

Verify if group has email capabilities:

// Get Group node
group_object_id = "12345678-1234-1234-1234-123456789012"

if (result.mailEnabled) {
console.log("Group email: " + result.mail)
console.log("Mail nickname: " + result.mailNickname)
} else {
console.log("Group is not mail-enabled")
}

Tips for Effective Use

  • Object ID required: You must use the group's object ID, not the display name
  • Error handling: Use Try-Catch to handle groups that don't exist
  • Property access: Access any group property from the result object
  • Type checking: Use groupTypes, mailEnabled, and securityEnabled to identify group type
  • Caching: Store group information if you need it multiple times
  • Performance: Getting a single group is faster than listing all groups
  • Find group ID: Use List All Groups to find group IDs

Common Errors and Solutions

"Group Object Id cannot be empty"

Cause: The Group Object Id input was not provided.

Solution: Provide a valid group object ID:

group_object_id = "12345678-1234-1234-1234-123456789012"
// Must be a valid GUID format

"Response Status is not OK - Group not found"

Cause: No group exists with the specified object ID.

Solution:

  • Verify the group object ID is correct
  • Use List All Groups to find the correct ID
  • Handle the error with Try-Catch if group might not exist
try {
// Get Group node
group_object_id = "invalid-id"
} catch (error) {
console.log("Group not found: " + group_object_id)
// Handle accordingly
}

"Either Client Secret with Tenant ID and Client ID, or Access ID must be provided"

Cause: Neither access ID nor complete credentials were provided.

Solution:

// Option 1: Use Connect node
access_id = message.access_id

// Option 2: Provide all credentials
tenant_id = "your-tenant-id"
client_id = "your-client-id"
// Set Client Secret option from vault

"Invalid group object ID format"

Cause: Group object ID is not in correct GUID format.

Solution: Use proper GUID format:

// Valid format
group_object_id = "12345678-1234-1234-1234-123456789012"

// Invalid format
group_object_id = "Engineering Team" // Display name, not object ID

Best Practices

  1. Error handling: Always wrap Get Group in Try-Catch for production code
  2. Use object IDs: Store and use object IDs, not display names
  3. Property validation: Check if properties exist before accessing them
  4. Caching: Store group data if needed multiple times in the same flow
  5. Logging: Log group lookups for audit trails
  6. Performance: Don't repeatedly get the same group; store the result
  7. Type awareness: Understand the group type before performing operations
  8. Documentation: Document which groups are used in your automations