User profiles and workspace switching
User profiles let one application session hold several Microsoft Teams accounts. Each profile keeps its own saved login and Teams session, while the app shows one profile as the active Teams workspace at a time. The feature preserves the single-window experience and lets users add, rename, pin, switch, or remove accounts without changing the shared application settings.
This page extends Application lifecycle and workspace shell with the profile and workspace state that the desktop shell presents.
Profile model
Profile records
A profile is the saved identity and display record for one Teams account. The record has a stable id, a display name, avatar data, an isolated session reference, and small per-profile choices such as pin status or a URL override. The profile list and the active profile id are stored together in the application settings store, so the selected workspace survives an app restart. app/…/index.js
The profile record is not the Teams account itself. It is the app's handle for that account. Teams login data lives in the session named by the record, while the record supplies the name and state shown by the switcher and menus.
References: app/…/index.js• L39-47 app/…/index.js• L88-105
Session boundaries
Each newly added profile receives its own persistent Teams session. This boundary keeps cookies, tokens, local storage, and other browser data separate, so signing in to one workspace does not replace the sign-in for another. The original single-profile session remains the session for the first profile created during migration. app/…/index.js
The profile's session reference is fixed after creation. A profile update changes its label or preferences, not the account session that gives it access to Teams.
References: app/…/index.js• L5-7 app/…/index.js• L120-147 app/…/profileViewManager.js• L431-487
Profile lifecycle
Legacy profile bootstrap
When multi-account support is enabled, the app first tries to represent an existing Teams login as a profile. It checks the legacy Teams session for authentication cookies after startup and after navigation reaches a Teams page. If it finds a signed-in session, it creates Profile 0 against that same session, so the user keeps the existing login. app/…/profileViewManager.js
The bootstrap does not treat a visit to the Microsoft sign-in page as proof of a signed-in workspace. This prevents a partial login flow from creating a profile too early. app/…/profileViewManager.js
References: app/index.js• L702-716 app/…/profileViewManager.js• L191-220 app/…/profileViewManager.js• L267-315
Profile creation
The Add profile dialog collects a required name and optional workspace details such as a URL, initials, and avatar color. Saving creates the profile and moves the active workspace to it immediately, which takes the user to that profile's Teams sign-in flow. app/…/index.js
The main process validates the profile before it is saved. A rejected name or field value leaves the dialog open so the user can correct it without losing the form state. app/…/index.js
References: app/…/addProfile.js• L28-43 app/…/index.js• L75-97 app/…/index.js• L120-147
Profile management
The Manage profiles dialog presents the saved profiles and marks the active one. Users can rename a profile inline or pin it for a keyboard shortcut. A rename changes only the app label, so it does not reload Teams or require another sign-in. app/…/manageProfile.js
Removal is a destructive account action. After confirmation, the app deletes the profile record, closes its Teams surface, and clears the session data. Adding the profile again therefore starts a new sign-in flow. The active profile and the last remaining profile cannot be removed from the dialog. app/…/index.js
References: app/…/index.js• L88-119 app/…/index.js• L160-190 app/…/manageProfile.js• L203-221
Workspace switching
Switching surfaces
Users can switch from the Profiles menu or from the bottom-left avatar pill. Both surfaces use the same saved profile state, so the active checkmark, avatar, name, and shortcut labels stay aligned. The pill also provides direct access to the Add and Manage dialogs. app/…/profilesMenu.js
Pinned profiles can use Ctrl+Alt+1 through Ctrl+Alt+5 when the platform supports the app menu shortcuts. The limit keeps the shortcut set small and predictable. app/…/index.js
References: app/…/profilesMenu.js• L17-63 app/…/switcher.js• L43-77 app/…/switcher.js• L126-154
Active workspace
The active profile determines which Teams surface the user sees. Switching changes visibility between already-open profile surfaces instead of creating a new login session. This keeps each workspace warm, so drafts and live Teams state remain available when the user returns. app/…/profileViewManager.js
The following flow shows how a profile selection becomes the active Teams workspace and how the visible surface follows it.
flowchart LR
A[Profile menu or avatar pill] --> B[Select profile]
B --> C[Save active profile id]
C --> D[Show selected Teams surface]
C --> E[Update menu and switcher state]
D --> F[Active Teams workspace]
The profile views fill the main content area, while the switcher remains above them as app chrome. Details about view attachment, navigation, and deep-link activation belong to Desktop window management.
References: app/…/index.js• L108-118 app/…/profileViewManager.js• L404-427 app/…/profileViewManager.js• L612-635
State updates
Profile changes emit a shared state change that updates the visible workspace and its controls. The menu rebuilds its profile entries, the switcher refreshes its avatar and list, and an open Manage dialog refreshes its rows. This keeps a change from one surface visible on the others without requiring a restart. app/…/profileViewManager.js
The active Teams workspace is separate from the authentication flow that establishes its session. A workspace can be selected before its account has finished signing in. The sign-in page then belongs to that profile's session. See Authentication and single sign-on for the login boundary and sign-in flow.
References: app/…/profileViewManager.js• L161-170 app/…/index.js• L88-119 app/…/switcher.js• L145-154
Feature boundaries
Multi-account availability
Multi-account support is opt-in through multiAccount.enabled, which defaults to false. When it is off, the app keeps its single-profile behavior and does not expose the profile menu or switcher. The app also disables multi-account for the session when Intune authentication is enabled at the same time. app/…/options.js
Profile data can outlive the feature flag. Storage cleanup therefore includes saved profile sessions even when the switcher is not currently active. This avoids leaving account cookies behind when the user clears app storage. app/…/storagePartitions.js
References: app/…/options.js• L1077-1092 app/index.js• L101-108 app/…/index.js• L41-73 app/…/storagePartitions.js• L5-16
Shared application state
Profiles isolate Teams account sessions, not the whole application. Tray behavior, proxy settings, global shortcuts, certificate policy, and other app-wide choices remain shared. The active workspace is the scope for the visible Teams experience, while account-independent services continue to belong to the application as a whole.
References: app/…/profileViewManager.js• L111-124 app/…/options.js• L1077-1092
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the stored profile shape, active profile id, and the switcher and menu state payloads compatible.
- Keep profile creation and profile-view creation aligned so every saved non-legacy profile has a usable Teams surface.
- Keep removal aligned across the profile record, the visible view, descendant surfaces, and the profile session storage.
- Keep the legacy session bootstrap tied to a real Teams destination and authenticated session. Do not use a sign-in page visit as proof of a workspace.
- Keep the multi-account flag and Intune compatibility rule aligned with the menu, dialog, and view startup gates.
- Keep pinned-profile limits and shortcut slot order aligned between the profile manager, menu, switcher pill, and Manage dialog.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
multiAccount.enabled is false | The app does not create profile views or expose profile controls. | Keep feature startup and UI creation behind the same flag. |
| Multi-account and Intune are enabled together | The app disables multi-account for that session. | Treat the startup compatibility check as the source of truth. |
| Bootstrap runs before a real Teams landing | A signed-in legacy account may not appear in the profile list. | Bootstrap only after a Teams destination and an auth cookie are present. |
| A profile is removed | Its login and local Teams data are deleted and a later re-add needs sign-in. | Require confirmation and make active and last-profile removal unavailable. |
| A profile switch races with removal or another state change | The requested workspace may no longer exist and the switcher can show stale state. | Refresh profile state after a failed switch and push state after every profile event. |
| A profile record has no matching view | The active id can change without a visible Teams workspace. | Materialize saved profiles at view-manager startup and create views on profile add. |
Key files
| File | Why to read it |
|---|---|
| app/…/index.js | Defines the persisted profile model, active profile state, and profile lifecycle rules. |
| app/…/profileViewManager.js | Shows how profile state maps to Teams surfaces, workspace visibility, bootstrap, and removal cleanup. |
| app/…/switcher.js | Explains the user-facing workspace picker and its state refresh behavior. |
| app/…/profilesMenu.js | Shows the menu path for adding, managing, and switching profiles. |
| app/…/index.js | Shows how a new profile becomes the active workspace after validation. |
| app/…/index.js | Shows rename, pin, confirmation, and removal behavior. |
| app/index.js | Shows when profile persistence and workspace views are connected during application startup. |
| app/…/options.js | Defines the opt-in multi-account setting and its compatibility boundary. |
| app/…/storagePartitions.js | Shows why storage cleanup includes all saved profile sessions. |