Step by Step: Export Office 365 OneDrive Data

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

This step is exactly the same as in my post on PST exports. To do this, simply go to that blog post and read through the instructions in phase one. If you’ve already followed those steps, congrats. Phase one here is done. If not, seriously, go do it. I’m not going to write it out twice or copy paste (Google gets pissy if you do that).

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).

  1. 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”.
    Tenant Name
  2. 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 user@domain.com, you’ll convert it to user_domain_com. We’ll use that for a placeholder in the next step.
  3. Combine the values from 1 and 2 in the following way to get the URL: https://company-my.sharepoint.com/personal/user_domain_com
  4. 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.
  5. Next, select New Search.
  6. Click Modify next to Select Locations
  7. Select Choose Sites under the SharePoint section. Then click Choose Sites on the blade that pops up.
    Choose, Mortal!
  8. 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.
    Add a URL
  9. 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.
  10. 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.
    Name your search
  11. 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. Search Preview view
  12. 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.

  1. 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.
    Searcg Details
  2. 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”
    Start the export

    1. 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.
    2. 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.
  3. Click Export to start the export process. This will take some time to complete, depending on how much data there is in the search.
  4. 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.
    Export Data
  5. 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.
  6. 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.
  7. 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).
    Progress!

Leave a Reply

Your email address will not be published. Required fields are marked *