Microsoft 365 Integration

VerifiedCaution

Access Microsoft 365 data through the Microsoft Graph API. Retrieve user profiles (display name, email, department, etc.) and read or search emails with filters and KQL queries. Ideal for answering questions about Outlook messages, user info, or any Microsoft 365 data.

Sby Skills Guide Bot
ProductivityIntermediate
6/2/2026
Claude Code
#microsoft-365#graph-api#email#user-info#outlook

Recommended for

Automated summary

This skill enables access to Microsoft 365 data such as emails and user profiles via the Microsoft Graph API.

Strengths

  • Read emails with advanced search and filtering options.
  • Retrieve user profile information (name, email, title, department, etc.).
  • Use KQL syntax for precise email searches.

Limitations

  • Requires Azure AD app registration and environment variable setup.
  • Limited to a single target user (defined in MS365_TARGET_USER).
  • Read-only access; cannot send or modify emails.
When to use it

Use this skill to fetch emails or user information from Microsoft 365.

When not to use it

Do not use it if you need to send emails, modify data, or access multiple users without modification.

Security analysis

Caution
Quality score90/100

The skill uses Bash to execute Node.js scripts that handle Microsoft 365 data via the Graph API. It requires setting sensitive environment variables and runs npm install. While the instructions are legitimate, the skill could be used to exfiltrate email data if the agent is compromised or if scripts are tampered with. No destructive commands are present, but the power of network access and secret handling warrants caution.

Findings
  • •Uses environment variables for secrets (client secret) which could be exposed if the agent logs the environment.
  • •Executes npm install/npm run build, which may pull untrusted dependencies if the package.json is not verified.
  • •Makes outbound network calls to Microsoft Graph API, potentially leaking data if misused.
How this analysis is made

Examples

Get last 10 emails
Show me my last 10 emails from my inbox.
Search emails by subject and sender
Find emails from john@example.com with 'budget' in the subject.
Get user profile info
Retrieve the user profile information for the target user.

name: ms365 description: Access Microsoft 365 data via Microsoft Graph API. Read emails, search messages, get user profile information. Use when the user asks about emails, messages, Outlook, user info, or Microsoft 365 data. license: MIT metadata: author: agentskills version: "1.0.0" api_provider: graph.microsoft.com allowed-tools: Bash(node:*)

Microsoft 365 Integration

Access Microsoft 365 data through the Microsoft Graph API. This Skill provides capabilities to read emails, search messages, and retrieve user profile information.

Prerequisites

Before using this Skill, you must:

  1. Install Node.js dependencies:
cd scripts && npm install && npm run build
  1. Set up Azure AD application and configure environment variables (see SETUP.md for detailed instructions)

Required Environment Variables

Set these environment variables before using the Skill:

export MS365_TENANT_ID="your-tenant-id"
export MS365_CLIENT_ID="your-client-id"
export MS365_CLIENT_SECRET="your-client-secret"
export MS365_TARGET_USER="user@example.com"

Instructions

Getting User Profile Information

To retrieve user profile information:

node scripts/dist/user-info.js

This returns a JSON object with:

  • Display name
  • Email address
  • User principal name
  • Proxy addresses
  • Job title
  • Department
  • Office location
  • Phone numbers

Reading Emails

To retrieve recent emails:

node scripts/dist/email.js --top 20

Available options:

  • --top <number>: Number of messages to retrieve (default: 20, max: 999)
  • --search <query>: Search query using KQL syntax
  • --filter <odata>: OData filter expression
  • --folder <name>: Specific mail folder (e.g., "Inbox", "Sent Items", "Drafts")

Examples:

Get 50 most recent emails:

node scripts/dist/email.js --top 50

Search for emails about "budget":

node scripts/dist/email.js --search "subject:budget"

Get unread emails:

node scripts/dist/email.js --filter "isRead eq false" --top 10

Get emails from specific folder:

node scripts/dist/email.js --folder "Inbox" --top 30

Search for emails from specific sender:

node scripts/dist/email.js --search "from:john@example.com"

Email Data Structure

Each email message includes:

  • id: Message ID
  • subject: Email subject line
  • from: Sender information (name and email address)
  • receivedDateTime: When the email was received (ISO 8601 format)
  • bodyPreview: Preview text of the email body
  • body: Full email body (HTML or plain text)
  • hasAttachments: Boolean indicating if email has attachments
  • isRead: Boolean indicating if email has been read
  • importance: Message importance (normal, low, high)

Search Query Syntax

When using --search, you can use Keyword Query Language (KQL):

  • subject:keyword - Search in subject
  • from:email@example.com - Search by sender
  • to:email@example.com - Search by recipient
  • body:keyword - Search in email body
  • hasattachments:true - Only emails with attachments
  • received:today - Emails received today
  • received>=2024-01-01 - Emails received on or after date

Combine multiple criteria:

node scripts/dist/email.js --search "from:manager@example.com subject:report received:thisweek"

OData Filter Syntax

When using --filter, you can use OData expressions:

  • isRead eq false - Unread messages
  • hasAttachments eq true - Messages with attachments
  • importance eq 'high' - High importance messages
  • receivedDateTime ge 2024-01-01T00:00:00Z - Messages received after date

Combine filters with and/or:

node scripts/dist/email.js --filter "isRead eq false and hasAttachments eq true"

Best Practices

  1. Limit results: Use --top to limit the number of messages retrieved to improve performance
  2. Use specific searches: Narrow down results with search queries or filters to find relevant emails faster
  3. Check environment variables: Ensure all required environment variables are set before running commands
  4. Handle large mailboxes: For mailboxes with thousands of emails, use filters or search to avoid timeouts

Troubleshooting

"Missing required environment variables" error:

  • Verify all four MS365_* environment variables are set
  • Check for typos in variable names
  • Ensure variables are exported in your current shell session

"Error fetching emails" or authentication errors:

  • Verify Azure AD application has correct API permissions
  • Ensure client secret is valid and not expired
  • Check that the target user exists in your tenant
  • See SETUP.md for permission requirements

Empty results:

  • Verify the target user has emails in their mailbox
  • Check folder name spelling if using --folder
  • Try without filters/search to ensure basic connectivity works

Security Notes

  • Client secrets should be treated as passwords - never commit them to version control
  • Consider using Azure Key Vault or similar secure storage for credentials in production
  • The service account needs appropriate permissions - follow principle of least privilege
  • Regularly rotate client secrets according to your organization's security policy

Additional Resources

For detailed setup instructions including Azure AD configuration, see SETUP.md.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/microsoft-365-integration-mm5t8bm6/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/microsoft-365-integration-mm5t8bm6' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/microsoft-365-integration-mm5t8bm6/download' --output '.skill-downloads/microsoft-365-integration-mm5t8bm6/SKILL.md.part' && mv '.skill-downloads/microsoft-365-integration-mm5t8bm6/SKILL.md.part' '.skill-downloads/microsoft-365-integration-mm5t8bm6/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash(node:*)

Original excerpt: Prerequisites

Before using this Skill, you must:

  1. Install Node.js dependencies:
cd scripts && npm install && npm run build
  1. Set up Azure AD application and configure environment variables (see SETUP.md for detailed instructions)

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/microsoft-365-integration-mm5t8bm6/SKILL.md' && test -s '.skill-downloads/microsoft-365-integration-mm5t8bm6/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/ms365' && cp -R '.skill-downloads/microsoft-365-integration-mm5t8bm6' '.claude/skills/ms365'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/microsoft-365-integration-mm5t8bm6'

openskills read 'microsoft-365-integration-mm5t8bm6'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/microsoft-365-integration-mm5t8bm6/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills