← Back to articles Exchange

Mailbox Import/Export Microsoft Graph APIs Now Generally Available

Mailbox Import/Export Microsoft Graph APIs Now Generally Available

What's Changing

Microsoft has announced general availability (GA) of the mailbox import and export Microsoft Graph APIs, marking the completion of a modern replacement for the deprecated Exchange Web Services (EWS). These APIs provide full-fidelity mailbox data migration capabilities with granular permission controls and support for primary and shared mailboxes in Exchange Online.

The APIs moved from preview to GA with minimal breaking changes, meaning organizations who pilot-tested the preview will find the API contract largely stable for production deployment.

Critical Gotcha The exported item format is NOT a general-purpose interchange format. Export streams must be preserved exactly as-is for re-import. Do not attempt to parse, transform, or manipulate exported data outside of the import operation, or you will lose fidelity and import will fail.

Who's Affected & When

This GA release affects all organizations with Exchange Online subscriptions. The APIs are:

  • Now available: All tenants can use the mailbox import and export APIs immediately
  • Opt-in: APIs are not auto-enabled; you must register an application in Microsoft Entra ID and request the appropriate Graph permissions
  • Supported mailbox types (GA): Primary mailboxes and shared mailboxes only
  • NOT yet supported: Archive mailboxes, public folders, and group mailboxes (roadmap pending)
  • Regional availability: Worldwide for all Exchange Online regions
  • License requirement: Exchange Online subscription required

There is no deprecation deadline announced yet for EWS, but Microsoft guidance indicates new development should target the Graph APIs for all future mailbox automation.

Supported Mailbox Types (GA) ✓ Primary Individual user mailboxes ✓ Shared Team mailboxes delegated access Not Yet Supported (Roadmap) ✗ Archive In development ✗ Public In development ✗ M365 Group In development
The mailbox import/export APIs support primary and shared mailboxes immediately. Archive, public folder, and group mailboxes are on the product roadmap.

What This Means for Your Environment

The GA release removes the preview designation and opens these APIs for production use. If you have EWS scripts or applications performing mailbox migrations, data exports, or folder management, you now have a supported, modern alternative.

Immediate Impact

Migration and automation workflows: You can now confidently build production integrations using the Graph APIs for primary and shared mailbox operations. The API contract is stable and won't change in breaking ways.

Permission model: The APIs use fine-grained Microsoft Graph permission scopes (e.g., Mail.ReadWrite, Mail.ReadWrite.Shared). You must grant these explicitly at the application level or user delegation level—there's no blanket "access everything" permission.

Data export format: When you export mailbox items, you receive an opaque binary stream. This stream is only valid for re-import back into Exchange Online. You cannot parse it, convert it to XML/JSON, or move it to other systems. This is a deliberate design to ensure full-fidelity preservation of all item metadata.

Archive and public folder gap: If your organization relies on archive mailbox migrations or public folder management, these remain unsupported. You must continue using EWS or other legacy tools for those workloads until the APIs mature.

What You Should Do Now

  1. Inventory current EWS usage: Document all scripts, applications, and scheduled tasks that depend on EWS. Prioritize mailbox import/export and folder management operations.
  2. Test in non-production: Register an Entra ID application, grant Graph permissions, and run import/export operations against test mailboxes before production rollout.
  3. Validate permission scopes: Ensure your application has only the scopes it needs. Use Mail.ReadWrite for general mailbox access, Mail.ReadWrite.Shared if accessing shared mailboxes.
  4. Implement retry logic: The APIs use standard Outlook throttling (429 Too Many Requests). Code exponential backoff and respect the Retry-After header.
  5. Plan archive/public folder strategy: If you use these mailbox types, do not plan an EWS migration yet. Stay informed via the Microsoft 365 developer blog for GA announcements on those features.
Pro Tip Start by testing export on a non-critical shared mailbox. Verify that exported data can be re-imported without loss. This confirms your permissions and network setup are correct before migrating critical user data.

Technical Implementation Essentials

Authentication & Permissions

To use the APIs, your application must authenticate with a Microsoft Entra ID access token and request one or more of these permission scopes:

Scope Purpose Mailbox Type
Mail.ReadWrite Read/write own mailbox folders and items Primary
Mail.ReadWrite.Shared Read/write shared mailboxes Shared
Mailbox.Migration GA Import/export operations specifically Primary, Shared
// Sample: Authenticate and obtain access token (Client Credentials flow)
// Register app in Entra ID, configure certificate or client secret

POST https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id={app-id}
&client_secret={secret-or-certificate}
&scope=https://graph.microsoft.com/.default

Core API Operations

The mailbox import/export APIs center on two main jobs:

  • Mailbox Folder Discovery:

    Enumerate the folder structure of a target mailbox to identify which folders contain data to export.

    GET /me/mailFolders
    
    // Returns folder list with IDs, displayName, childFolderCount
    // Use folder ID in subsequent export operations
  • Export Mailbox Items:

    Create an export job for a specific folder. The API returns an opaque stream containing all items in that folder with full metadata preserved.

    POST /me/mailboxes/{mailbox-id}/exportJobs
    Content-Type: application/json
    
    {
      "sourceFolder": "Inbox",
      "targetRootFolder": null
    }
    
    // Response: binary stream with full-fidelity item data
    // IMPORTANT: Do not parse or modify this stream
  • Import Mailbox Items:

    Submit a preserved export stream to create items in a target mailbox folder. The stream must match the exact output from export.

    POST /me/mailboxes/{mailbox-id}/importJobs
    Content-Type: application/octet-stream
    
    [binary export stream from previous export job]
    
    // Response: import job ID and status
    // Monitor job completion via GET /importJobs/{id}
  • Folder Management:

    Create, update, or delete folders within a mailbox for organizing imported content.

    POST /me/mailFolders
    Content-Type: application/json
    
    {
      "displayName": "Archived 2024"
    }
    
    // Create subfolders:
    POST /me/mailFolders/{parent-folder-id}/childFolders
    Content-Type: application/json
    
    {
      "displayName": "Q1 2024"
    }
  • Export/Import Workflow 1. Source Exchange Online User Mailbox Export API Call 2. Opaque Binary Stream (DO NOT PARSE) Store Exactly 3. Storage Blob, Database, File System Retrieve 4. Import Exact Stream ⚠ DO NOT Attempt These Converting to XML/JSON, parsing structure, filtering items, transforming metadata, applying custom logic Folder Management Create Folders POST /mailFolders + displayName Organize Content Create folder hierarchy before import
    The complete mailbox export/import workflow. Critical rule: export streams are opaque and must never be parsed or transformed. Store them exactly as-is, then submit them unchanged to the import operation.

    Critical Caveats & Common Mistakes

    Export Stream Format Trap The single most common mistake: attempting to parse or transform exported data. The export format is intentionally undocumented and opaque. It is not XML, JSON, or any standard format. If you try to:
    • Parse the binary stream
    • Convert it to another format
    • Filter items before re-import
    • Apply custom transformations
    ...you will corrupt the data and import will fail silently or with cryptic errors. The supported pattern is: Export → Store → Import back unchanged.
    Error / Issue Root Cause Resolution
    403 Forbidden on export call Missing or insufficient Graph permission scopes Verify application has Mail.ReadWrite or Mail.ReadWrite.Shared granted and consented by tenant admin
    404 Not Found on archive mailbox Archive mailboxes not supported in GA Target primary mailbox instead; archive support pending on product roadmap
    429 Too Many Requests (throttling) Exceeding Outlook resource limits Implement exponential backoff; respect Retry-After header; stagger requests across multiple time windows
    Import job fails with no items created Export stream was modified, parsed, or corrupted after export Ensure stream is preserved byte-for-byte from export; do not apply any transformations
    Only IPM subtree items visible after import API only supports items in the Interpersonal Message (IPM) tree Non-IPM folders (like certain system or hidden folders) are not exported; expected behavior

    Throttling Behavior

    The APIs consume Outlook resource quotas. If you hit throttling limits (HTTP 429), you'll receive a Retry-After header. Implement exponential backoff starting at 2 seconds, doubling up to a maximum of 60 seconds between retries.

    // Pseudo-code: Retry with exponential backoff
    let retryCount = 0;
    const maxRetries = 5;
    const baseDelay = 2000; // 2 seconds
    
    while (retryCount < maxRetries) {
      try {
        const response = await exportMailbox(mailboxId);
        if (response.status === 429) {
          const retryAfter = response.headers['Retry-After'] || baseDelay * Math.pow(2, retryCount);
          await sleep(retryAfter);
          retryCount++;
          continue;
        }
        return response; // Success
      } catch (error) {
        throw error;
      }
    }
    

    Migration Path from EWS

    If you currently use EWS for mailbox operations, here's a phased migration strategy:

  • Phase 1: Inventory (Week 1–2) Document all EWS code and scripts. Identify operations:
    • Mailbox folder enumeration → Graph GET /mailFolders
    • Item export → Graph export API
    • Item import → Graph import API
    • Folder creation/management → Graph folder operations
  • Phase 2: Pilot (Week 3–4) Register an Entra ID application. Test export/import on a non-critical shared mailbox or user test account. Verify stream integrity.
  • Phase 3: Validation (Week 5–6) Run parallel export operations (EWS + Graph) on the same mailbox. Compare item counts and metadata. Confirm no data loss.
  • Phase 4: Staged Rollout (Week 7+) Deploy Graph-based code to production. Start with low-risk mailboxes (shared team mailboxes). Monitor for errors. Roll out to primary mailboxes once confidence is high.
  • Archive Mailbox Gap If your organization exports archive mailboxes via EWS, plan to continue using EWS for that workload until the Graph APIs support archives. Do not assume you can export primary and archive using the same migration approach.

    Production Readiness Checklist

    Before deploying to production, verify:

    • Application registered in Microsoft Entra ID
    • Graph permissions (Mail.ReadWrite, Mail.ReadWrite.Shared, Mailbox.Migration) granted by tenant admin
    • Tested export on a primary mailbox in non-production
    • Tested export on a shared mailbox in non-production
    • Export stream preserved and re-imported successfully without modification
    • Exponential backoff retry logic implemented for 429 responses
    • Error handling for 403, 404, 429, and general export/import failures
    • Throttling monitoring enabled (X-RateLimit-* headers logged)
    • Audit logging configured for all export/import operations
    • Backup/recovery strategy documented (export streams stored securely)
    • Stakeholders informed of archive/public folder limitations

    Key Takeaways

    The mailbox import and export Microsoft Graph APIs are now production-ready for primary and shared mailbox operations. The APIs provide a modern, permission-scoped replacement for EWS with full-fidelity data preservation. However, treat the export stream as a black box—never parse, transform, or manipulate it. The unsupported mailbox types (archive, public folder, group) remain on the product roadmap; plan your migration strategy accordingly.

    Start testing today in non-production. Begin with shared mailboxes (lower risk), validate that import restores data without loss, then phase in primary mailbox migrations. Monitor the Microsoft 365 developer blog for GA announcements on archive and public folder support.

    Was this article helpful?

    🎓 Ready to go deeper?

    Practice real MD-102 exam questions, get AI feedback on your weak areas, and fast-track your Intune certification.

    Start Free Practice → Book a Session
    Souhaiel Morhag
    Souhaiel Morhag
    Microsoft Endpoint & Modern Workplace Engineer

    Souhaiel Morhag is a Microsoft Intune and endpoint management specialist with hands-on experience deploying and securing enterprise environments across Microsoft 365. He founded MSEndpoint.com to share practical, real-world guides for IT admins navigating Microsoft technologies — and built the MSEndpoint Academy at app.msendpoint.com/academy, a dedicated learning platform for professionals preparing for the MD-102 (Microsoft 365 Endpoint Administrator) certification. Through in-depth articles and AI-powered practice exams, Souhaiel helps IT teams move faster and certify with confidence.

    Related Articles

    Popular on MSEndpoint