Resources

Build your own Microsoft 365 Executive Assistant inside ChatGPT

What This Assistant Can Do

Once authorized, the assistant will be able to:

  • Search and summarize recent emails
  • Show upcoming calendar events
  • Browse and retrieve OneDrive files
  • Answer questions using filtered data (e.g., emails from a specific sender, files modified today, etc.)

This guide was key to getting everything set up. If you are new to creating apps in Azure, then this will be very helpful for you to get your necessary keys setup: https://community.openai.com/t/gpt-how-to-configuring-microsoft-graph-oauth-and-various-third-party-apis/554034

Step-by-Step Setup

1. Create the GPT

Visit chat.openai.com/create and fill out the following fields

Name: _____'s Executive Assistant

Description: Acts as an executive assistant. Retrieves emails, calendar events, and OneDrive files using Microsoft Graph API to assist with daily tasks and scheduling.

Instructions:

You are an Executive Assistant.

Use Microsoft Graph to:

- Summarize, search, and filter recent emails and calendar events

- Check upcoming meetings and deadlines

- Retrieve and summarize OneDrive files

When responding, be:

- Clear, concise, and professional

- Focused on action-oriented output (e.g. summaries, links, key details)

- Capable of filtering by sender, date, file name, etc.

Use the following endpoints:

- `/me/messages` — to get emails

- `/me/events` — to get calendar events

- `/me/drive/root/children` — to get OneDrive files

Always verify the user is authenticated before making a request. Automatically handle large result sets by applying date filters or limiting to the top few results.

Conversation Starters:

  • “What meetings do I have this week?”
  • “Do I have any unread emails from Ana?”
  • “Show me the most recent files in OneDrive”
  • “What’s on my calendar today?”

2. Enable Actions

Under the Actions section, enter the base URL : graph.microsoft.com

The callback URL will be created automatically by ChatGPT. You may have to try to use it and get an error message in order to get the right code. Copy this from the field automatically created by OpenAI (e.g., looks like https://chat.openai.com/aip/g-.../oauth/callback).

3. Set the OpenAPI Schema

Click the ⚙️ button in the Actions area, and paste in the following schema:

{
  "openapi": "3.1.0",
  "info": {
    "title": "Microsoft Graph Assistant",
    "version": "1.0"
  },
  "servers": [
    { "url": "https://graph.microsoft.com/v1.0" }
  ],
  "paths": {
    "/me/messages": {
      "get": {
        "operationId": "getEmails",
        "summary": "Get user emails",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "subject": { "type": "string" },
                          "from": {
                            "type": "object",
                            "properties": {
                              "emailAddress": {
                                "type": "object",
                                "properties": {
                                  "name": { "type": "string" },
                                  "address": { "type": "string" }
                                }
                              }
                            }
                          },
                          "receivedDateTime": { "type": "string" },
                          "webLink": { "type": "string" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [{ "OAuth2": [] }]
      }
    },
    "/me/events": {
      "get": {
        "operationId": "getCalendarEvents",
        "summary": "Get calendar events",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "subject": { "type": "string" },
                          "start": {
                            "type": "object",
                            "properties": {
                              "dateTime": { "type": "string" },
                              "timeZone": { "type": "string" }
                            }
                          },
                          "end": {
                            "type": "object",
                            "properties": {
                              "dateTime": { "type": "string" },
                              "timeZone": { "type": "string" }
                            }
                          },
                          "webLink": { "type": "string" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [{ "OAuth2": [] }]
      }
    },
    "/me/drive/root/children": {
      "get": {
        "operationId": "getOneDriveFiles",
        "summary": "Get OneDrive root files",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": { "type": "string" },
                          "webUrl": { "type": "string" },
                          "lastModifiedDateTime": { "type": "string" },
                          "file": { "type": "object" },
                          "folder": { "type": "object" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [{ "OAuth2": [] }]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
            "tokenUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/token",
            "scopes": {
              "User.Read": "Sign in and read your profile",
              "Mail.Read": "Read user mail",
              "Calendars.Read": "Read user calendar",
              "Files.Read": "Read user files"
            }
          }
        }
      }
    }
  }
}

Congrats! You did it!

Example Prompts to start teh conversation. 

Start with these, then in a second request ask for something more helpful (e.g. help me create a meeting agenda, research a topic before the call, etc)

  • “What meetings do I have today?”
  • “Get my most recent email from [person]”
  • “Show me my latest OneDrive documents”
  • “Do I have anything scheduled for this Friday afternoon?”
  • “What emails did I receive from [person] this week?”
  • Common Issues & Troubleshooting

    401/403 Errors: Make sure you've logged in and authorized the GPT with the correct Microsoft account.

    "Too much data" errors: Ask more specific questions, or filter using terms like “from today” or “top 3 emails.”

    No files or emails showing: Confirm that the account you're using has actual content. Also verify that Graph Explorer returns data.

    OAuth callback mismatch: Ensure your redirect URI exactly matches what’s entered in Azure App Registration.

    OpenAPI schema errors: Double-check that the schema version is 3.1.0 and that the security block is correct.