teams-api-1-microsoft-graph-api-client

Sub-skill of teams-api: 1. Microsoft Graph API Client.

5 stars

Best use case

teams-api-1-microsoft-graph-api-client is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sub-skill of teams-api: 1. Microsoft Graph API Client.

Teams using teams-api-1-microsoft-graph-api-client should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/1-microsoft-graph-api-client/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/business/communication/teams-api/1-microsoft-graph-api-client/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/1-microsoft-graph-api-client/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How teams-api-1-microsoft-graph-api-client Compares

Feature / Agentteams-api-1-microsoft-graph-api-clientStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sub-skill of teams-api: 1. Microsoft Graph API Client.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 1. Microsoft Graph API Client

## 1. Microsoft Graph API Client


```python
# graph_client.py
# ABOUTME: Microsoft Graph API client for Teams operations
# ABOUTME: Handles authentication and common API calls

from azure.identity import ClientSecretCredential
from msgraph import GraphServiceClient
from msgraph.generated.models.chat_message import ChatMessage
from msgraph.generated.models.item_body import ItemBody
from msgraph.generated.models.body_type import BodyType
import os
from dotenv import load_dotenv

load_dotenv()

class TeamsGraphClient:
    """Microsoft Graph client for Teams operations"""

    def __init__(self):
        self.credential = ClientSecretCredential(
            tenant_id=os.environ["AZURE_TENANT_ID"],
            client_id=os.environ["AZURE_CLIENT_ID"],
            client_secret=os.environ["AZURE_CLIENT_SECRET"]
        )

        self.client = GraphServiceClient(
            credentials=self.credential,
            scopes=["https://graph.microsoft.com/.default"]
        )

    async def send_channel_message(
        self,
        team_id: str,
        channel_id: str,
        content: str,
        content_type: str = "html"
    ):
        """Send a message to a Teams channel"""

        message = ChatMessage(
            body=ItemBody(
                content_type=BodyType.Html if content_type == "html" else BodyType.Text,
                content=content
            )
        )

        result = await self.client.teams.by_team_id(team_id) \
            .channels.by_channel_id(channel_id) \
            .messages.post(message)

        return result

    async def send_chat_message(
        self,
        chat_id: str,
        content: str
    ):
        """Send a message to a chat (1:1 or group)"""

        message = ChatMessage(
            body=ItemBody(
                content_type=BodyType.Html,
                content=content
            )
        )

        result = await self.client.chats.by_chat_id(chat_id) \
            .messages.post(message)

        return result

    async def list_teams(self):
        """List all teams the app has access to"""
        result = await self.client.groups.get()
        teams = [g for g in result.value if g.resource_provisioning_options
                 and "Team" in g.resource_provisioning_options]
        return teams

    async def list_channels(self, team_id: str):
        """List channels in a team"""
        result = await self.client.teams.by_team_id(team_id) \
            .channels.get()
        return result.value

    async def get_channel_messages(
        self,
        team_id: str,
        channel_id: str,
        top: int = 50
    ):
        """Get recent messages from a channel"""

        result = await self.client.teams.by_team_id(team_id) \
            .channels.by_channel_id(channel_id) \
            .messages.get(
                request_configuration=lambda config:
                    setattr(config.query_parameters, 'top', top)
            )

        return result.value

    async def reply_to_message(
        self,
        team_id: str,
        channel_id: str,
        message_id: str,
        content: str
    ):
        """Reply to a channel message"""

        reply = ChatMessage(
            body=ItemBody(
                content_type=BodyType.Html,
                content=content
            )
        )

        result = await self.client.teams.by_team_id(team_id) \
            .channels.by_channel_id(channel_id) \
            .messages.by_chat_message_id(message_id) \
            .replies.post(reply)

        return result

    async def create_online_meeting(
        self,
        subject: str,
        start_time: str,
        end_time: str,
        attendees: list
    ):
        """Create an online meeting"""
        from msgraph.generated.models.online_meeting import OnlineMeeting
        from msgraph.generated.models.meeting_participants import MeetingParticipants
        from msgraph.generated.models.meeting_participant_info import MeetingParticipantInfo
        from msgraph.generated.models.identity_set import IdentitySet
        from msgraph.generated.models.identity import Identity

        participant_list = [
            MeetingParticipantInfo(
                identity=IdentitySet(
                    user=Identity(id=attendee)
                )
            )
            for attendee in attendees
        ]

        meeting = OnlineMeeting(
            subject=subject,
            start_date_time=start_time,
            end_date_time=end_time,
            participants=MeetingParticipants(
                attendees=participant_list
            )
        )

        result = await self.client.me.online_meetings.post(meeting)
        return result

    async def get_user_by_email(self, email: str):
        """Get user details by email"""
        result = await self.client.users.by_user_id(email).get()
        return result

# Usage example
async def main():
    client = TeamsGraphClient()

    # List teams
    teams = await client.list_teams()
    for team in teams:
        print(f"Team: {team.display_name} ({team.id})")

    # Send channel message
    if teams:
        team_id = teams[0].id
        channels = await client.list_channels(team_id)
        if channels:
            channel_id = channels[0].id
            await client.send_channel_message(
                team_id,
                channel_id,
                "<b>Hello from Python!</b> This is an automated message."
            )

*Content truncated — see parent skill for full reference.*

Related Skills

public-knowledge-graph-governance

5
from vamseeachanta/workspace-hub

Maintain public-safe knowledge graph artifacts for llm-wiki and similar markdown knowledge bases. Use when changing graph generators, validators, schema docs, weekly freshness checks, or public/private source-scope boundaries.

teams-meeting-pipeline

5
from vamseeachanta/workspace-hub

Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.

client-llm-wiki-factory

5
from vamseeachanta/workspace-hub

Operator checklist for instantiating a new per-client private llm-wiki repo under workspace-hub [#2746](https://github.com/vamseeachanta/workspace-hub/issues/2746) + [#2731](https://github.com/vamseeachanta/workspace-hub/issues/2731) D4 (amended) naming convention `llm-wiki-<client>`.

baoyu-infographic

5
from vamseeachanta/workspace-hub

Infographics: 21 layouts x 21 styles (信息图, 可视化).

agent-teams-workspace-work-profile-updated-2026-03-10

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: Workspace Work Profile (Updated 2026-03-10).

agent-teams-work-queue-integration

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: Work Queue Integration.

agent-teams-subagent-startup-convention

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: Subagent startup convention (+2).

agent-teams-idle-state

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: Idle State.

agent-teams-dm-default-always-prefer

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: DM (default — always prefer) (+2).

agent-teams-decision-matrix-team-vs-sequential

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: Decision Matrix: Team vs Sequential.

agent-teams-core-constraint

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: Core Constraint.

agent-teams-agent-types-for-common-tasks

5
from vamseeachanta/workspace-hub

Sub-skill of agent-teams: Agent Types for Common Tasks.