How can I determine if OneDrive is active for a user in Office365 via the API?
Is there a way to tell the user has a OneDrive site (for an Office365 account)?
I am getting user list for my sharepoint site via
https: // {domain} -my.sharepoint.com/_api/web/siteusers
but there is no field to indicate if the user has an active OneDrive.By OneDrive I mean this kind of personal site;
HTTPS: // {domain} -my.sharepoint.com/personal/user_name_domain_microsoft_com
One way to find out is to access that url for that user and check if he gives a 404 response .
Am I trying to do this via REST API? Any help on this?
source to share
The following user properties can be used to distinguish between actual (or active) SPO users:
- Principal.PrincipalType Property - The
PrincipalType.User
value specifies the user as the primary type - UserIdInfo.NameIdIssuer property - configuration-agnostic reference to the type of name identifier issuer, for SPO users its value:
urn:federation:microsoftonline
REST request:
/_api/web/siteusers?$filter=PrincipalType eq 1 and UserId/NameIdIssuer eq 'urn:federation:microsoftonline'
source to share
You cannot do this right now using the O365 File REST API, but you can use Powershell cmdlets (for example, this page http://blog.blksthl.com/2014/08/07/office-365-guide-series-provision -onedrive-for-business-using-powershell / shows how to use Powershell to provide OneDrive for Business for a list of users, from there it's just a small modification to print if those people have OneDrive)
But another workaround you talked about is using the O365 files REST API and referring to this endpoint:
https://your_SP_URL.com/_api/v1.0/me/drive
If you receive an error, you will know that the Drive has not yet been shared. This is an ugly solution, but it should work great for your purpose.
source to share