Graph mailboxes export-import forbidden

Peter Højbjerg Sørensen 20 Omdømmepoint
2025-10-16T10:33:49.3933333+00:00

I'm trying to use the graph beta api to do an import-export operation. I need to move/copy a mail from user mailbox to a shared mailbox.

The exportItems and createImportSession works fine but when i make the import call to the import URL i get a status of 403 Forbidden.

Any suggestions on what i'm missing?

const importsesdata = await importses.json().then(async (r2) => {
        const importop = await fetch(
        r2.importUrl,
        {
          method: "POST",
          headers: {
                "Content-type": "application/json",
      },
          body:'{"FolderId": "Inbox", "Mode":"create","Data":"'+r.value[0].data+'"}'
        }
      );
        });
https://graph.microsoft.com/beta/admin/exchange/mailboxes/{ID}/exportItems

https://graph.microsoft.com/beta/admin/exchange/mailboxes/{ID}/createImportSession
Microsoft 365 og Office | Andet
0 kommentarer Ingen kommentarer
{count} stemmer

2 svar

Sortér efter: Meget nyttig
  1. Emmanuel Santana 33,160 Omdømmepoint Uafhængig rådgiver
    2025-10-16T12:02:15.8833333+00:00

    Hello. Is your app registered with application permissions (not delegated) and if MailboxItem.ImportExport.All has been granted admin consent in Entra ID?

    Also, check if an Application Access Policy is restricting your app. In PowerShell:

    Connect-ExchangeOnline
    Get-ApplicationAccessPolicy
    Test-ApplicationAccessPolicy -Identity "<target mailbox>" -AppId "<your app ID>"
    

    If it shows AccessDenied, your app isn’t allowed to touch that mailbox. Add the mailbox to the security group defined in the policy, or temporarily remove the restriction.


  2. Peter Højbjerg Sørensen 20 Omdømmepoint
    2025-10-16T14:11:31.7033333+00:00

    I don't know if it's relevante but i'm developing a outlook addin an using the nested app authentication

    https://dori-uw-1.kuma-moon.com/en-us/office/dev/add-ins/develop/enable-nested-app-authentication-in-your-add-in


Dit svar

Svar kan markeres som "Accepteret" af spørgsmålsforfatteren og "Anbefalet" af redaktører, hvilket hjælper brugerne med at vide, at svaret løste forfatterens problem.