You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Teams JS SDK或MS Graph API为自定义Microsoft Teams标签页触发显示"New"徽章

Awesome question! I’ve worked with custom Teams tabs before, so let’s walk through exactly how you can trigger that "New" badge when your tab content gets updated—using either the Teams JS SDK or Microsoft Graph API.

Using the Teams JavaScript SDK

If you want to trigger the badge directly from your tab’s frontend (right after a user updates content), you can use the Teams JS SDK to update the tab’s settings. Teams detects changes to the tab’s configuration and will show the "New" badge automatically for all channel members.

Here’s how to do it:

  1. Make sure you’ve loaded the latest stable version of the Teams JS SDK in your tab.
  2. After your content finishes updating, call microsoftTeams.settings.setSettings() to modify a unique identifier for the tab (like adding a timestamp to the entityId or contentUrl). This tells Teams the tab has fresh content:
microsoftTeams.settings.setSettings({
  entityId: `your-custom-tab-${Date.now()}`, // Unique ID with timestamp to trigger update
  contentUrl: "https://your-tab-domain.com?contentVersion=" + Date.now(), // Optional: versioned URL
  suggestedDisplayName: "Your Tab Name"
}).then(() => {
  console.log("Tab settings updated—'New' badge should now appear for all users");
}).catch(error => {
  console.error("Failed to update tab settings:", error);
});
  • Note: The user triggering this update needs permissions to modify the tab (usually channel member or higher access works).

Using Microsoft Graph API

If you need to trigger the badge from a backend service (for example, when content is updated automatically without user interaction), the Graph API is your best bet. You can update the tab’s configuration directly, which will trigger the "New" badge across all users in the channel.

Steps to implement:

  1. Call the PATCH endpoint for Teams tabs:
    PATCH https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/tabs/{tab-id}
    
  2. In the request body, update a unique property like entityId to signal a content change:
{
  "configuration": {
    "entityId": "your-tab-entity-" + new Date().toISOString()
  }
}
  1. Ensure your app has the right permissions: Use TeamsTab.ReadWriteSelfForTeam (if updating tabs your app installed) or TeamsTab.ReadWrite.All (for broader access).

Once this request succeeds, Teams will immediately show the "New" badge next to your tab name for every member in the channel.

Quick Notes

  • The SDK method is great for user-initiated content updates, while the Graph API is perfect for automated backend triggers.
  • Test with multiple user accounts to confirm the badge appears consistently—sometimes you might need to refresh Teams to see the update right away.

内容的提问来源于stack exchange,提问作者vt.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 04:42:32