How to grant access to deleted user’s Onedrive for Business library
A couple of weeks ago we had an issue which resulted in some users getting deleted from Office 365. Because of a sync tool we use, we had to recreate the user accounts instead of restoring them. As a result of this (different SID), the new users also got a new Onedrive for Business library and could no longer access their existing library.
Listing all disabled user profiles
In the Office 365 admin center, go to the SharePoint admin center and click User profiles and Manage User Profiles.
While using various searches, I noticed that every user had i:0#.f|membership in front of their UPN. So I decided to use that as the search term, turns out this lists all users. After changing the view to Profiles missing from import, I got a list of all the disabled users.
Changing Onedrive for Business library permissions
Now that we can see the profiles, we can change the permissions. Click the three dots behind the profile and select Manage Site collection owners.
There you can set the new user as a Site collection administrator. Once you click OK, the users can access the old library using the web version of Onedrive for Business.
There is one caveat to all this, the old profiles will be deleted after 30 days, as part of the Office 365 automated cleanup.