Office 365’s OneDrive is a wonderful tool for storing, sharing, and securing access to files of all types, but running an export of Office 365 data can be confusing. One of the rules for OneDrive is that, unless shared, data is normally only accessible by the user who owns the OneDrive folder. But when employees leave the company, accessing that data and exporting it to a more accessible location requires a bit of work. In my last post, I covered mail export to PST using the Compliance and Security center. The way to export OneDrive data is similar in that it has the same three phases, Assign Permissions, Create Content Search, and Export Data, but there currently isn’t a well documented way to limit the Content Search to *just* OneDrive data. For this post, I’ll go over the way to get data out of OneDrive without needing to log in as the user.
1. Assign Permissions
Visit Microsoft 365 Content Search – Can’t Preview or Download Results to learn how to set permissions for Content Search and Download in Microsoft/Office 365. (Note: The process for exporting data from SharePoint is almost exactly the same as OneDrive, so follow the steps below in that situation as well).
2. Create Content Search
This is the phase that is very much different from exporting to PST files. It takes a little bit more thought and examination to do it correctly. The thing that makes it hard is that the content search tools in O365 will not let you search for just OneDrive data. You have to search for SharePoint data. If you aren’t aware, though, OneDrive is 100% reliant on SharePoint to do its work. In fact, OneDrive is just a fancy name for a SharePoint library that is owned and accessible to only one user (As opposed to the central access capabilities of normal SharePoint libraries). So the trick to creating a Content Search job that exports only OneDrive data is to use the SharePoint URL that stores the data you want to export. Let me go over that in a step by step guide (In case you were wondering, yes, I’m reusing some pictures from my PST export post. Work smarter, not harder).
- First, find your organizational tenant name. This is done by going to the O365 Admin Portal, selecting Setup, then Domains, then looking for the domain that ends in .onmicrosoft.com. For this guide, we’ll say that we have company.onmicrosoft.com. With this example, the tenant name is “company”.
- Next, figure out the user’s login name. This will be easy to find in your user list. Go to Users > Active Users in the Admin Portal, look for your user, then look at the Username column to get this info. Convert that into the correct format by replacing the @ and all periods in the address with an underscore “_”. So for firstname.lastname@example.org, you’ll convert it to user_domain_com. We’ll use that for a placeholder in the next step.
- Combine the values from 1 and 2 in the following way to get the URL: https://company-my.sharepoint.com/personal/user_domain_com
- Now that we have the correct URL, lets start working on the Content Search job by going to https://protection.office.com and going to Search, then Content Search.
- Next, select New Search.
- Click Modify next to Select Locations
- Select Choose Sites under the SharePoint section. Then click Choose Sites on the blade that pops up.
- Here’s where the URL from step 3 comes in. After step 7, you’ll have a screen that asks for a URL. Take the URL you developed in step 3 and enter that value. Click + or enter to add it to the selection list, then tick the box next to it, as seen below.
- You can use this search method to select multiple users for export as well by repeating steps 1-3 and 8 for each user you want to export OneDrive data for. When you have all the OneDrive URLs you want to export added, Click Choose, Done, then Save.
- Click Save & Run to open a blade that will as you to enter a name for the search. Give it a name and click Save to start the search.
- Next, you wait for the search to complete. It will take longer if you have a complicated query or if you have a lot of data to search through. Once the search is done, you will see a view that shows a preview of the results that you can look through to make sure you got the data you need.
- If you leave this view, you will go back to the Searches screen. Note that at first, you won’t see the search you just created in the list. Hit refresh and it will appear. Congrats, you’ve completed the Create Content Search phase.
3. Export Data
The steps here are very similar to the steps in the PST post, but I’ll put them here because there are some subtle differences. Before you can start, though, better fire up Internet Explorer or Edge.
- First, go to the searches view in the content search blade. You should see the search you created as long as you’ve refreshed the view, so click on it and it will give you a status screen showing whether the search is complete and how much data has been found.
- Click More, then select Export Results. You’ll get a blade with some options. There are different options for this export than for a Mailbox PST export. The two that matter for OneDrive export are “Include versions for SharePoint Files” and “Export files in a compressed (zipped) folder”
- Select “Include versions for SharePoint files” if you wish to get a copy of every version of a file that exists in the SharePoint database. This means you can export revisions before and after a change was made. Note that this option will significantly increase the size of the download, particularly if there are files that have been changed a lot.
- Select “Export files in a compressed (zipped) folder” if you want ZIP files instead of the full file structure the search covers. You will get a ZIP file for every user you search with this selection.
- Click Export to start the export process. This will take some time to complete, depending on how much data there is in the search.
- Go to the Exports view and click Refresh to show the new export. Click on it to see the status. There will probably be a progress bar showing how close the export is to finishing.
- You’ll also see an export key on the export status page. Copy this to the clipboard and click Download Results. You can start the download even when the export job hasn’t completed.
- Once you click the option to download results, an applet will install itself and begin running to manage the download. It will give you two text boxes, one for the string you copied to the clipboard in step 5, and another to select a directory to store the data. Don’t worry about creating a new directory in the location you save, since the applet will generate a folder with the same name as the export job. Fill those in with the appropriate data and click Start.
- Once you hit start, the download will start. You’ll have a screen with an inaccurate (like, insanely inaccurate at times) progress meter. Just let that go until it says it’s done. Once it’s done, you should have a folder with a number of CSV files (these are reports on the export) and more subfolders that have all the files in them, lined up by user. And that’s it. (Yes, the progress bar says PSTs, but this looks no different for OneDrive exports).