0
votes

I need to create an universal app windows 10 that allow users save his files in his own OneDrive Business account.

I read that I need to register the app with Azure Active Directory (developer account) and then request permissions for OneDrive for Business.

But:

Question1: if app is set as "multi-tenant" in Azure AD, every user will store his files in his own business account onedrive?

user logged: [email protected] ---> onedrive business account contoso.onmicrosoft.com

user logged: [email protected] --> onedrive business account: otherbusiness.onmicrosoft.com

etc.

Question 2: then, when we call api url and app is multi-tenant, what tenant can put here:

https://{tenant}-my.sharepoint.com/_api/v2.0

2

2 Answers

1
votes

Question 1

If you declare your app as multi-tenant, your organisation (e.g. contoso.onmicrosoft.com) will be the owner of the application. Then, other organisation tenants (e.g. awesomebusiness1.onmicrosoft.com, awesomebusiness2.onmicrosoft.com etc.) will be able to authenticate with your app. The authentication will work and in your AzureAD you will see the users of awesomebusiness1 and awesomebusiness2 which are users of your app. Then, the onedrive business account of the connected user will be [email protected] if John Doe is authenticated with your multitenant app.

Question2

Most of the Office365 Api and Graph api do not include the name of the tenant. For example see this documentation. Indeed, this simplifies the creation of the REST request. However, in your case, if you need the url of the targeted sharepoint site, that will be your responsibility to create it dynamically. When the user connects your retrieve the name of its tenant (e.g. awesomebusiness2) and create the url (e.g. https://awesomebusiness2-my.sharepoint.com/_api/v2.0)

1
votes

Question 2

You can get tenant url from Discovery Service, check Step 3 from OneDrive for Business authentication and sign in article. Discovery Service will return MyFiles node with serviceEndpointUri which is exactly what you need

https://{tenant}-my.sharepoint.com/_api/v2.0