Microsoft Teams 数据 API
Microsoft Teams 是微软公司面向 Microsoft 365 组织推出的职场聊天与会议应用,也是 Skype for Business 的接班产品。左侧栏列出用户所在的团队与频道,带收藏、未读标记、@提及计数和最新消息预览;一对一聊天、群聊与频道话题都在同一个会话视图中展开,可直接撰写回复。人员选择器可搜索公司通讯录,彩色在线状态圆点显示同事是空闲、忙碌还是请勿打扰,并附带状态备注以及当天在办公室还是远程办公;用户也能在手机上锁定自己的状态并指定到期时间。“会议”页签列出当天日程,含回复状态、组织者和一键加入在线会议的按钮;“我的”页签则展示个人资料、职位与联系方式。各项功能按 Microsoft 365 许可开放,从免费版、试用版到小型企业方案和 Copilot 附加项;信息屏障策略还能让受监管机构阻止指定群组之间互相聊天。在职场消息领域,Teams 与 Slack、Google Chat 竞争,在视频会议领域则与 Zoom 竞争;美国、印度和巴西的企业、小型企业与学校每天都用它开展内部沟通。
租户内的身份记录以 mri 为键,把整套数据串在一起:个人资料与人员搜索返回 userPrincipalName、displayName、jobTitle、department、companyName 与 tenantId,另有各自带 visibility 与 searchable 标志的 emailsInfo 和 phonesInfo 条目;聊天与频道成员名单还会补上信息屏障标志 isIbBarred 与 isBlocked。在线状态查询为每位成员叠加 availability、activity、lastSeenAt、状态备注 note 以及混合办公的 workLocation(location、subLocation),头像解析则返回 imageUri,无照片时给出 avatarHint。
会话数据按话题分页输出:每条消息携带 content、composetime、from、imdisplayname 与 clientmessageid;团队与频道列表补充 channelType、isFavorite、mentionCount、lastMessageArrivalTime 和 previewMessage。日历视图返回每场活动的 Subject、Start、End、Organizer、ResponseStatus、IsOnlineMeeting 与 OnlineMeetingUrl;许可读取返回 skuPartNumber 及按服务计划的 provisioningStatus,账号许可详情还以 isFreemium、isTrial、isCopilot 与 isTeamsSmb 标出账号层级。
Teams 感知工具直接基于这些字段构建:夜间任务把 mri、userPrincipalName、jobTitle 与 tenantId 同步进 HRIS 或 ITSM,让离职与岗位变更第二天一早就能体现;服务台在每个工单负责人旁显示实时 availability 与 workLocation,坐席在 @ 提及前就知道谁正在通话;值班看板借助 OnlineMeetingUrl 把响应人员直接深链进当前会议;记录管道则把消息话题归档用于电子发现(eDiscovery)。openData Studio 把这些 Teams 数据变成可调用的开放数据。
应用截图
API 端点一览
以下端点与请求/响应示例均依据应用界面推导重构,为示意说明,并非实际抓包。
读取当前登录用户的个人资料
GET
/v1/profile/me?expand=identityFlagsosint返回当前登录用户的身份记录(mri、UPN、职位、租户、邮箱 / 电话可见性),“我的”页签与其他所有登录调用都依赖它。
认证方式: 当前登录工作账号的 OAuth2 Bearer 访问令牌(目录 / 资料范围)。可选的 expand 查询参数会随资料一并返回账号的身份标志。
- mri
- objectId
- displayName
- givenName
- surname
- userPrincipalName
- jobTitle
- department
- companyName
- tenantId
- tenantName
- userType
- isSkypeTeamsUser
- skypeTeamsInfo
- emailsInfo
- address
- searchable
- visibility
- phonesInfo
- number
- country
- nationalNumber
- riskScore
- searchableByProfile
GET /v1/profile/me?expand=identityFlags HTTP/1.1 Authorization: Bearer <access-token> Accept: application/json{ "mri": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "objectId": "3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "displayName": "Alex Rivera", "givenName": "Alex", "surname": "Rivera", "email": "[email protected]", "mail": "[email protected]", "userPrincipalName": "[email protected]", "jobTitle": "Product Manager", "department": "Platform", "companyName": "Example Corp", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "tenantName": "Example Corp", "userType": "Member", "isSkypeTeamsUser": true, "skypeTeamsInfo": {"isSkypeTeamsUser": true}, "emailsInfo": [{"address": "[email protected]", "searchable": true, "visibility": "Everyone"}], "phonesInfo": [{"number": "+14255550123", "country": "US", "nationalNumber": "4255550123", "searchable": false, "visibility": "Contacts"}], "riskScore": "0", "searchableByProfile": true }在组织通讯录中搜索人员
POST
/v1/directory/people:search?expand=identityFlagsosint执行应用内人员选择器 / 搜索结果页的通讯录查询,返回匹配的用户记录(mri、UPN、jobTitle、tenantId、身份标志)。
认证方式: 当前登录工作账号的 OAuth2 Bearer 访问令牌(目录范围)。
- value
- mri
- objectId
- displayName
- userPrincipalName
- jobTitle
- department
- tenantId
- type
- userType
- isSkypeTeamsUser
- imageUri
- skypeTeamsInfo
POST /v1/directory/people:search?expand=identityFlags HTTP/1.1 Authorization: Bearer <access-token> Content-Type: application/json "alex rivera"{ "value": [ { "mri": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "objectId": "3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "displayName": "Alex Rivera", "email": "[email protected]", "userPrincipalName": "[email protected]", "jobTitle": "Product Manager", "department": "Platform", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "type": "Member", "userType": "Member", "isSkypeTeamsUser": true, "imageUri": "https://example.invalid/avatar/alex", "skypeTeamsInfo": {"isSkypeTeamsUser": true} } ] }按成员 ID 批量获取用户资料
POST
/v1/directory/people:batchGetosint把聊天 / 频道成员名单中的一批成员 ID 水合为完整用户记录,包括信息隔离限制标志。
认证方式: 当前登录工作账号的 OAuth2 Bearer 访问令牌(目录范围)。
- mri
- objectId
- displayName
- userPrincipalName
- jobTitle
- tenantId
- isIbBarred
- isBlocked
- userType
- skypeTeamsInfo
- isSkypeTeamsUser
- value
POST /v1/directory/people:batchGet HTTP/1.1 Authorization: Bearer <access-token> Content-Type: application/json [ "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "8:orgid:9c88e201-4b77-41aa-b012-55aa11cc99ee" ]{ "value": [ { "mri": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "objectId": "3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "displayName": "Alex Rivera", "email": "[email protected]", "userPrincipalName": "[email protected]", "jobTitle": "Product Manager", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "isIbBarred": false, "isBlocked": false, "userType": "Member", "skypeTeamsInfo": {"isSkypeTeamsUser": true} } ] }批量查询用户在线状态
POST
/v1/presence:batchLookuposint按一批成员 ID 返回在线状态、状态签名、混合办公位置及任何强制状态,驱动聊天与联系人列表上的绿 / 黄 / 红状态点。
认证方式: 在线状态服务的 OAuth2 Bearer 访问令牌。请求体为 {mri, eTag} 对的列表,未变化的条目可借此跳过。
- mri
- eTag
- userMri
- availability
- activity
- capabilities
- lastSeenAt
- note
- mRawStatusMessage
- mStatusExpiry
- mStatusPublishTime
- workLocation
- location
- subLocation
- locationExpiry
- locationForced
- forcedAvailability
- mAvailability
- mActivity
- mExpiry
- mPublishTime
POST /v1/presence:batchLookup HTTP/1.1 Authorization: Bearer <access-token> Content-Type: application/json [ {"mri": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "eTag": "W/\"datetime'2026-09-27T10:00:00Z'\""}, {"mri": "8:orgid:9c88e201-4b77-41aa-b012-55aa11cc99ee", "eTag": ""} ][ { "userMri": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "availability": "Available", "activity": "Available", "capabilities": "Audio|Video|ScreenShare", "eTag": "W/\"datetime'2026-09-27T10:04:12Z'\"", "lastSeenAt": "2026-09-27T10:04:12Z", "note": { "mRawStatusMessage": "In a customer call", "mStatusExpiry": "2026-09-27T18:00:00Z", "mStatusPublishTime": "2026-09-27T09:00:00Z" }, "workLocation": { "location": "Office", "subLocation": "Building 34", "locationExpiry": "2026-09-27T23:59:59Z", "locationForced": false }, "forcedAvailability": { "mAvailability": "Busy", "mActivity": "InACall", "mExpiry": "2026-09-27T11:00:00Z", "mPublishTime": "2026-09-27T10:00:00Z" } } ]发布强制在线状态
PUT
/v1/presence/me/overrideopendata从移动端发布当前登录用户的强制在线状态(Available / Busy / DoNotDisturb 及活动),在请求的过期时间前持续生效。
认证方式: 在线状态服务的 OAuth2 Bearer 访问令牌。
- id
- deviceType
- availability
- activity
- desiredExpirationTime
PUT /v1/presence/me/override HTTP/1.1 Authorization: Bearer <access-token> Content-Type: application/json { "id": "Mobile", "deviceType": "Mobile", "availability": "Busy", "activity": "InACall", "desiredExpirationTime": "2026-09-27T11:00:00Z" }{ "id": "Mobile", "deviceType": "Mobile", "availability": "Busy", "activity": "InACall", "desiredExpirationTime": "2026-09-27T11:00:00Z" }分页读取聊天或频道消息
GET
/v1/messaging/threads/{threadId}/messagesopendata为会话视图分页拉取单聊、群聊或频道话题的消息历史,包括编写时间、发送者 ID 与已读水位。
认证方式: 以令牌请求头发送的聊天作用域会话令牌(由会话令牌端点签发),外加聊天端点注册时颁发的设备注册令牌。
- threadId
- view
- startTime
- pageSize
- messages
- id
- clientmessageid
- conversationid
- from
- imdisplayname
- messagetype
- contenttype
- content
- composetime
- originalarrivaltime
- properties
- consumptionHorizon
- forwardLink
GET /v1/messaging/threads/19:[email protected]/messages?view=msnp24Equivalent&startTime=0&pageSize=50 HTTP/1.1 Authorization: sessionToken <session-token> RegistrationToken: registrationToken=<registration-token> Accept: application/json{ "messages": [ { "id": "1758962400123", "clientmessageid": "18446744073709550001", "conversationid": "19:[email protected]", "from": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "imdisplayname": "Alex Rivera", "messagetype": "RichText/Html", "contenttype": "text", "content": "<p>Standup notes are in the wiki.</p>", "composetime": "2026-09-27T10:00:00.123Z", "originalarrivaltime": "2026-09-27T10:00:00.200Z", "properties": { "consumptionHorizon": "1758962400123;1758962400123;1758962400000" } } ], "_metadata": { "forwardLink": "/v1/messaging/threads/19:[email protected]/messages?syncState=abc" } }向聊天或频道话题发送消息
POST
/v1/messaging/threads/{threadId}/messagesopendata从输入框发布一条新的聊天或频道消息,返回服务器分配的 id、到达时间与回显正文。
认证方式: 以令牌请求头发送的聊天作用域会话令牌,外加已注册聊天端点的设备注册令牌。
- content
- contenttype
- messagetype
- clientmessageid
- imdisplayname
- OriginalArrivalTime
- id
- conversationid
- from
- composetime
POST /v1/messaging/threads/19:[email protected]/messages HTTP/1.1 Authorization: sessionToken <session-token> RegistrationToken: registrationToken=<registration-token> Content-Type: application/json { "content": "<p>Shipping the build at 16:00.</p>", "contenttype": "text", "messagetype": "RichText/Html", "clientmessageid": "18446744073709550002", "imdisplayname": "Alex Rivera" }{ "OriginalArrivalTime": "2026-09-27T10:05:01.004Z", "id": "1758962701004", "clientmessageid": "18446744073709550002", "conversationid": "19:[email protected]", "from": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "imdisplayname": "Alex Rivera", "messagetype": "RichText/Html", "contenttype": "text", "content": "<p>Shipping the build at 16:00.</p>", "composetime": "2026-09-27T10:05:00.980Z" }列出当前登录用户的日历视图
GET
/v1/calendar/me/viewopendata为“会议”页签返回当天的日历事件,包括主题、时间窗口、RSVP、组织者与在线会议加入链接。
认证方式: OAuth2 Bearer 访问令牌(日历范围)。时间窗口以 startDateTime 与 endDateTime 传入。
- startDateTime
- endDateTime
- Id
- Start
- End
- iCalUId
- Subject
- Type
- SeriesMasterId
- Locations
- IsAllDay
- IsOnlineMeeting
- IsCancelled
- OnlineMeeting
- OnlineMeetingUrl
- ResponseStatus
- Organizer
- OriginalStartTimeZone
- Recurrence
- DateTime
- TimeZone
- JoinUrl
- DisplayName
- EmailAddress
- Name
- Address
- Response
- Time
GET /v1/calendar/me/view?startDateTime=2026-09-27T00:00:00Z&endDateTime=2026-09-28T00:00:00Z&$select=Id,Start,End,iCalUId,Subject,Type,SeriesMasterId,Locations,IsAllDay,IsOnlineMeeting,IsCancelled,OnlineMeeting,OnlineMeetingUrl,ResponseStatus,Organizer,OriginalStartTimeZone,Recurrence HTTP/1.1 Authorization: Bearer <access-token> Accept: application/json{ "value": [ { "Id": "AAMkAGI2AAAt2j2NAAA=", "iCalUId": "040000008200E00074C5B7101A82E00800000000A0A0A0A0", "Subject": "Platform standup", "Type": "SingleInstance", "SeriesMasterId": null, "Start": {"DateTime": "2026-09-27T15:00:00.0000000", "TimeZone": "UTC"}, "End": {"DateTime": "2026-09-27T15:30:00.0000000", "TimeZone": "UTC"}, "Locations": [{"DisplayName": "Teams meeting"}], "IsAllDay": false, "IsOnlineMeeting": true, "IsCancelled": false, "OnlineMeetingUrl": "https://meetings.example.invalid/join/19%3ameeting_abc123", "OnlineMeeting": {"JoinUrl": "https://meetings.example.invalid/join/19%3ameeting_abc123"}, "ResponseStatus": {"Response": "Accepted", "Time": "2026-09-26T18:01:00Z"}, "Organizer": {"EmailAddress": {"Name": "Alex Rivera", "Address": "[email protected]"}}, "OriginalStartTimeZone": "Pacific Standard Time", "Recurrence": null } ] }列出当前登录用户的团队与频道
GET
/v1/workspaces/me/summaryopendata返回当前登录用户优化后的左侧栏团队与频道列表,包括收藏标记、未读/提及计数与最后一条消息预览。
认证方式: OAuth2 Bearer 访问令牌(工作区聚合范围)。
- conversations
- conversationId
- parentConversationId
- displayName
- conversationType
- channelType
- tenantId
- isFavorite
- isUnread
- mentionCount
- consumptionHorizon
- lastMessageId
- lastMessageArrivalTime
- previewMessage
GET /v1/workspaces/me/summary HTTP/1.1 Authorization: Bearer <access-token> Accept: application/json{ "conversations": [ { "conversationId": "19:[email protected]", "parentConversationId": null, "displayName": "Platform", "conversationType": "Team", "channelType": null, "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "isFavorite": true, "isUnread": true, "mentionCount": 2, "consumptionHorizon": "1758962400123;1758962400123;1758962400000", "lastMessageId": 1758962400123, "lastMessageArrivalTime": 1758962400123, "previewMessage": "Standup notes are in the wiki." }, { "conversationId": "19:[email protected]", "parentConversationId": "19:[email protected]", "displayName": "General", "conversationType": "Channel", "channelType": "Standard", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "isFavorite": true, "isUnread": true, "mentionCount": 0, "consumptionHorizon": "1758962400123;1758962400123;1758962400000", "lastMessageId": 1758962400123, "lastMessageArrivalTime": 1758962400123, "previewMessage": "Standup notes are in the wiki." } ] }读取账户的许可 SKU
GET
/v1/account/me/licensesopendata返回当前登录用户分配的订阅 SKU 与服务计划(含会议/聊天计划),用于控制付费功能的开启。
认证方式: 具有组织用户读取范围的 OAuth2 Bearer 访问令牌。
- id
- skuId
- skuPartNumber
- servicePlans
- servicePlanId
- provisioningStatus
- value
GET /v1/account/me/licenses HTTP/1.1 Authorization: Bearer <access-token> Accept: application/json{ "value": [ { "id": "c7890e12-aaaa-4bbb-8ccc-0123456789ab", "skuId": "6fd2c87f-b296-42f0-b197-1e91e994b900", "skuPartNumber": "ENTERPRISEPACK", "servicePlans": [ { "servicePlanId": "57ff2da0-89d1-429b-9cd3-4d0f0c7d0a1e", "provisioningStatus": "Success" } ] } ] }用账户令牌交换聊天会话令牌
GET
/v1/auth/sessionTokenopendata把账户级 OAuth2 令牌换成聊天作用域会话令牌、成员 ID 与区域路由信息,供每次聊天服务调用(消息、长轮询、在线状态文档)使用。
认证方式: 应用认证服务的 OAuth2 Bearer 访问令牌。返回的 tokens.skypeToken 随后作为 Authorization 令牌请求头发送到聊天服务调用。
- tokens
- skypeToken
- expiresIn
- tokenType
- mri
- skypeId
- region
- partition
- regionOverride
- userInfo
- cid
- primaryMemberName
- skypeName
- licenseDetails
- isFreemium
- isTrial
- isCopilot
- isAdvComms
- isTeamsSmb
GET /v1/auth/sessionToken HTTP/1.1 Authorization: Bearer <access-token> Accept: application/json{ "tokens": { "skypeToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", "expiresIn": 86400, "tokenType": "skype" }, "mri": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "skypeId": "orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "region": "amer", "partition": "amer", "regionOverride": null, "userInfo": { "cid": 0, "primaryMemberName": "[email protected]", "skypeName": "orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33" }, "licenseDetails": { "isFreemium": false, "isTrial": false, "isCopilot": false, "isAdvComms": false, "isTeamsSmb": false } }批量解析头像
GET
/v1/directory/people/avatarsosint按成员 ID + displayName 批量解析聊天列表与联系人卡片的头像 imageUri;当用户没有照片时返回 avatarHint。
认证方式: 当前登录工作账号的 OAuth2 Bearer 访问令牌(目录范围)。usersInfo 是成员 ID + displayName 对的紧凑编码。
- usersInfo
- mri
- displayName
- imageUri
- avatarHint
- etag
- value
GET /v1/directory/people/avatars?usersInfo=%5B%7B%22mri%22%3A%228%3Aorgid%3A3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33%22%2C%22displayName%22%3A%22Alex%20Rivera%22%7D%5D HTTP/1.1 Authorization: Bearer <access-token> Accept: application/json{ "value": [ { "mri": "8:orgid:3f2a1c90-9b11-4d2e-a7c4-0f8e6b1d2a33", "displayName": "Alex Rivera", "imageUri": "https://example.invalid/avatar/alex", "avatarHint": "ProfilePicture", "etag": "W/\"datetime'2026-08-01T12:00:00Z'\"" } ] }
数据类别
- 资料
- 通讯录
- 在线状态
- 消息
- 日历
- 许可
- 头像
数据使用场景与案例
组织通讯录对账
夜间任务拉取 me 资料与人员搜索端点(mri、userPrincipalName、jobTitle、tenantId),并向上同步到 HRIS 或 ITSM,让离职与岗位变更次日出现在 Teams 感知工具中。
客服台的实时在线状态叠加
客服台把 MRI 批次提交到在线状态批量查询端点,在每个工单负责人旁展示 availability、activity、lastSeenAt 与 workLocation,让客服在 @ 提及前知道谁在通话中。
从运营控制台加入会议
值班看板读取日历视图端点的 Id、Subject、Start、End、IsOnlineMeeting 与 OnlineMeetingUrl,无需打开日历页签即可把响应人员深链进当前 Teams 会议。
聊天话题合规导出
在签发聊天作用域会话令牌后,记录管道分页拉取话题消息端点(content、composetime、from、imdisplayname、clientmessageid)归档,用于电子发现。
常见问题
Teams me 资料返回哪些身份字段?
me 资料调用返回 mri、objectId、displayName、givenName、surname、email、userPrincipalName、jobTitle、department、companyName、tenantId、tenantName、emailsInfo、phonesInfo 与身份标志。
Teams 如何区分聊天与通讯录调用的认证?
通讯录、日历与许可调用发送 OAuth2 Bearer 令牌。聊天调用先把该账户令牌换成聊天作用域会话令牌,再在分页或发送话题消息时以令牌请求头发送会话令牌,外加设备注册令牌。
可以读取同事的哪些在线状态属性?
在线状态批量查询调用返回 availability、activity、capabilities、lastSeenAt、状态签名、混合办公 workLocation(location、subLocation)以及任何强制状态时间窗。
Teams 会议加入链接来自哪里?
“会议”页签加载日历视图端点。每个事件携带 Id、iCalUId、Subject、Start、End、IsOnlineMeeting、OnlineMeetingUrl 与 Organizer。
与 Microsoft Teams 相似的应用
- Slack — 基于频道的团队消息工具,拥有成熟的应用生态与强大的搜索;免费版保留 90 天消息历史。
- Zoom Workplace — 以视频会议为核心的工作空间,AI Companion 可自动生成会议纪要与待办事项,并集成了团队聊天与白板。
- Google Chat — 谷歌的团队消息应用,与 Docs、Sheets、Drive 和 Calendar 深度集成,适合使用 Google Workspace 的组织。
- Cisco Webex — 面向大型企业的会议、通话与消息套件,适合已部署思科基础设施的组织。
- RingCentral — 把云电话(PBX)、视频会议与团队消息整合进一套统一通信系统。
- Discord — 围绕社区服务器的实时语音、视频与文字聊天平台,也被部分团队用作工作沟通工具。
- Mattermost — 可自托管的团队消息平台,面向需要合规与数据自主掌控的组织。
- Rocket.Chat — 开源的团队消息平台,可完全自托管并支持深度定制。
更多通讯协作类应用
相关主题
- microsoft teams api
- teams 聊天消息
- teams 在线状态 api
- teams 人员搜索
- teams 日历视图
- teams 会话令牌
- mri userPrincipalName
- teams licenseDetails
需要集成这个 App 的数据 API?
我们可为任意指定 App 交付定制集成——源码交付 USD 500 起,或托管 API 按调用计费。告诉我们您需要的数据即可。
- 每个项目均签 NDA 与 SOW
- 3–7 天交付
- 验收通过后才付款
- 仅在授权范围内作业