Remove Members
Definition
The Remove Members action in Zenphi allows you to automatically remove one or more members from a Microsoft Teams Team, Channel, or Chat. This action is highly useful for managing access and ensuring that only the right users remain part of specific workspaces. Depending on the context (Team, Channel, or Chat), you can provide the relevant IDs and specify the members to be removed using their conversation member IDs.
Key capabilities include:
- Supporting removal of members across different Microsoft Teams contexts: Teams, Channels, and Chats.
- Handling bulk removal by accepting a comma-separated list of member IDs.
- Returning detailed output, including both successfully removed members and those that failed, for easy troubleshooting and error handling.
- Enforcing Microsoft Teams rules (e.g., standard channel memberships cannot be individually managed, as they inherit team-level membership).
This action streamlines member management in Teams and helps keep collaboration spaces secure and up-to-date.
Example Use Cases
1. Offboarding Employees
Automatically remove a departing employee from all Teams, Channels, and Chats to ensure secure offboarding and prevent unauthorized access.
2. Project Closure
When a project ends, remove external collaborators or temporary staff from project-specific Teams or Chats to clean up memberships.
3. Role Change or Reassignment
If a user changes roles within the company, use this action to remove them from Channels or Teams no longer relevant to their responsibilities.
4. Managing Guest Access
Quickly remove guest users or contractors once their collaboration period is over, keeping Teams secure and compliant with company policies.
5. Cleaning Up Inactive Chats
Automate the removal of users from Chats that are no longer active or relevant, improving organization and reducing clutter.
Inputs
The Remove Members action requires specific input fields depending on the context (Team, Channel, or Chat). Below is a detailed breakdown of each field and how it should be used.
Connection
Defines the Microsoft Teams connection that Zenphi will use to authenticate and perform the removal. Make sure the connection has the necessary permissions to manage memberships in Teams, Channels, or Chats.
Type
Select the scope from which you want to remove members. Options include:
- Team – Remove members from a Microsoft Team.
- Channel – Remove members from a specific channel inside a Team.
- Chat – Remove members from a one-to-one or group chat.
The additional input fields you need will depend on the selected type:
If Type = Team
-
Team Id Select the Team to remove members from.
- Once your connection is established, a list of available Teams will be displayed for easy selection.
- Alternatively, you can provide the Team Id directly by either hardcoding it (static value) or dynamically using the token picker (chain icon) from a previous action.
If Type = Channel
-
Team Id Select the Team that contains the channel where members will be removed. Same selection method as above (dropdown, hardcode, or token picker).
-
Channel Id Select the channel to remove members from.
- Important: You cannot remove individual members from a Standard channel. Standard channels automatically inherit the membership of their parent Team.
- You can only remove members from Private or Shared channels, where membership is explicitly managed.
If Type = Chat
-
Chat Id Select the Chat to remove members from.
- After establishing the connection, a list of available Chats will be displayed.
- Alternatively, you can provide the Chat Id directly using hardcoded input or dynamically via the token picker.
Members Ids
Specify the members you want to remove.
- You can select members from a dropdown list or enter a comma-separated list of member IDs.
- ⚠️ Important: This field only accepts Conversation Member IDs — not email addresses or user IDs. To ensure accuracy, use the token picker to pull valid IDs from a previous action (e.g., "List Members").
Outputs
When the Remove Members action runs, it produces the following outputs that help you track the success and any issues in the removal process:
Removed Members
A list of the members who were successfully removed from the Team, Channel, or Chat.
- Each entry contains the member ID that was processed.
- This allows you to confirm that the correct users were removed.
- You can use this output in later steps of your flow (e.g., to send a notification confirming removal).
Failed Members
A list of the members who could not be removed during the action.
-
Each entry contains the member ID that failed.
-
Failures can occur for reasons such as:
- The user does not exist in the specified Team, Channel, or Chat.
- The membership type does not allow manual removal (e.g., standard channels).
- Insufficient permissions in the Microsoft Teams connection.
-
You can use this output to log errors, send alerts, or retry the removal process in a controlled way.
Example
Imagine you have a project team in Microsoft Teams that included several external contractors. Now that the project is completed, you want to remove those contractors from the Team to ensure they no longer have access to project files and discussions.
To set this up in Zenphi:
-
Add the Remove Members action to your flow.
-
Choose Type = Team and select the specific Team ID.
-
In Members IDs, enter the IDs of the contractors you want to remove. You can provide these either by selecting from the dropdown, hardcoding them, or dynamically inserting them using the token picker from a previous action (e.g., from a “List Members” step).
-
Run the flow. Zenphi will remove the specified members and return two lists:
- Removed Members: contractors successfully removed.
- Failed Members: contractors who could not be removed (for example, if they were already removed or if permissions prevented it).
This setup helps you automate offboarding in Teams, keeping your workspaces secure and up to date.
Best Practices
- Use the Correct Member IDs
- This action requires conversation member IDs, not email addresses or user IDs.
- Always retrieve member IDs using a prior action such as List Members to avoid errors.
- Understand Channel Limitations
- You cannot remove members from a standard channel because its membership is inherited from the parent Team.
- To restrict access, consider using private channels or removing users directly from the parent Team instead.
- Validate Before Removal
- If removing multiple users, consider first running List Members and cross-checking their IDs.
- This ensures you’re targeting the right members and prevents accidental removals.
- Handle Edge Cases Gracefully
- Some removals may fail (e.g., if the member is already removed, is the last owner, or due to insufficient permissions).
- Always check the Failed Members output and build error-handling logic, such as sending a notification to an admin.
- Automate Offboarding Scenarios
- For security and compliance, integrate this action into employee offboarding flows.
- Test in a Non-Production Environment
- Always test the removal process in a sandbox or smaller group before applying it to a production Team or Chat.
- This reduces the risk of mistakenly removing critical members.
Updated about 1 hour ago