It sounds like you are encountering a 403 Forbidden error when trying to upload the item using the ImportUrl after successfully creating the import session. This error typically indicates that there are issues with the authentication token or permissions.
Here are a few things you can check:
- Token Validity: Ensure that the token you are using in the ImportUrl is still valid and has not expired. The
expirationDateTimeproperty in themailboxItemImportSessionresponse indicates how long the token is valid. - Permissions: Double-check that the application permission
MailboxItem.ImportExport.Allis correctly granted and that the user or service principal making the request has the necessary permissions to perform the import operation. - Correct FolderId: Make sure that the
FolderIdyou are providing in the JSON body is valid and that the user has access to that folder. - Base64 Encoding: Verify that the data you are sending in the
Datafield is correctly base64 encoded and represents a valid EML file.
If all of these checks are correct and you are still facing issues, you may want to review the API documentation for any additional requirements or reach out to Microsoft support for further assistance.
References: