In Office365 you can attach documents stored in SharePoint Online/OneDrive. However it doesnât send the actual document but only a link to that document.
So when Retain attempts to archive an attached document it often runs into trouble because the retain user, while it does have ApplicationImpersonation right, doesnât have rights to anything outside of Exchange. So Retain will error because it knows there is supposed to be something there but canât reach it.
11:04:16, 704[Thread-4920] [ERROR] ExchangeAttachment: error while creating attachment.
java.io.IOException: SharePointError - Impersonation has no access to: https://gwava-my.sharepoint.com/personal/user08_gwava_onmicrosoft_com1/Documents/Email attachments/office 365 users(1) (1).txt
What needs to be done is the retain user needs be added as a âsite collection administratorâ in SharePoint/OneDrive. Start by going to the Office365 admin page and selecting SharePoint.
Go to the Site Collections, select the collection to add the retain user too, click the âOwnersâ tab.
You can now add the retain user as a âSite collection administratorâ. This way the retain user will have rights to access the data.
This works for individual site collections, but it would be difficult to do that individually if you have many site collections. There is no way in SharePoint to change more than one collection at a time.
Changing Across The Domain
However, there is a SharePoint Online Management Shell script that you could modify for use to do all site collections at once.
You may have to change the Execution Policy to get the script to run. The following command will allow execution for the current Powershell session.
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process