Skip to main content

Search

teams search messages --query "deployment failed" --top 10 --output json
teams search users --query "alex" --top 10 --output json
teams search teams --query "engineering" --output json

Search results depend on Graph indexing, tenant policy, and the signed-in user's access.

Use user resolve when an agent needs a concrete user ID from a name or email before adding members, sending notifications, or creating chats:

teams user resolve alex@example.com --output json
teams user resolve "Alex Lee" --max-chats 50 --output json

Resolution tries exact /users lookup, then People API search when People.Read is available, then a bounded sweep of shared group and meeting chat rosters. People API hits are verified back through /users/{userPrincipalName} before the CLI returns a directory object ID.

For automation, inspect both candidates and stages in the JSON payload. Each candidate records whether it came from upn, people-search, or roster. Each stage reports hit, miss, forbidden, or skipped; the roster stage can also report skippedChats when individual rosters could not be read.

A People API candidate can still contain a UPN or email with no id when the token may search people but cannot verify the result through /users. Agents that need a Microsoft Entra object ID must require a non-null candidate id rather than treating the People resource ID as a user ID.