简体   繁体   English

多租户应用-OneDrive Business API

[英]Multi-Tenant app - OneDrive Business API

I need to create an universal app windows 10 that allow users save his files in his own OneDrive Business account. 我需要创建一个通用应用程序窗口10 ,该窗口允许用户将其文件保存在自己的OneDrive Business帐户中。

I read that I need to register the app with Azure Active Directory (developer account) and then request permissions for OneDrive for Business. 我读到我需要向Azure Active Directory(开发人员帐户)注册应用程序,然后请求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? 问题1 :如果将应用程序在Azure AD中设置为“多租户”,那么每个用户都将其文件存储在自己的企业帐户onedrive中吗?

user logged: xxxx@contoso.onmicrosoft.com ---> onedrive business account contoso.onmicrosoft.com 用户登录:xxxx@contoso.onmicrosoft.com ---> onedrive业务帐户contoso.onmicrosoft.com

user logged: xxx@otherbusiness.onmicrosoft.com --> onedrive business account: otherbusiness.onmicrosoft.com 用户登录:xxx@otherbusiness.onmicrosoft.com-> onedrive企业帐户:otherbusiness.onmicrosoft.com

etc. 等等

Question 2: then, when we call api url and app is multi-tenant, what tenant can put here: 问题2:那么,当我们调用api url并且应用程序是多租户时,租户可以在此处放置什么:

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

Question 1 问题1

If you declare your app as multi-tenant, your organisation (eg contoso.onmicrosoft.com) will be the owner of the application. 如果您将应用程序声明为多租户,则您的组织(例如contoso.onmicrosoft.com)将是该应用程序的所有者。 Then, other organisation tenants (eg awesomebusiness1.onmicrosoft.com, awesomebusiness2.onmicrosoft.com etc.) will be able to authenticate with your app. 然后,其他组织租户(例如awesomebusiness1.onmicrosoft.com,awesomebusiness2.onmicrosoft.com等)将能够通过您的应用进行身份验证。 The authentication will work and in your AzureAD you will see the users of awesomebusiness1 and awesomebusiness2 which are users of your app. 身份验证将起作用,并且在您的AzureAD中,您将看到awesomebusiness1和awesomebusiness2的用户,它们是您的应用程序的用户。 Then, the onedrive business account of the connected user will be johndoe@awesomebusiness1.onmicrosoft.com if John Doe is authenticated with your multitenant app. 然后,如果John Doe已通过您的多租户应用程序进行身份验证,则已连接用户的onedrive业务帐户将为johndoe@awesomebusiness1.onmicrosoft.com。

Question2 问题2

Most of the Office365 Api and Graph api do not include the name of the tenant. 大多数Office365 Api和Graph API不包含租户的名称。 For example see this documentation . 例如,请参阅此文档 Indeed, this simplifies the creation of the REST request. 实际上,这简化了REST请求的创建。 However, in your case, if you need the url of the targeted sharepoint site, that will be your responsibility to create it dynamically. 但是,根据您的情况,如果您需要目标共享点网站的URL,则有责任动态创建它。 When the user connects your retrieve the name of its tenant (eg awesomebusiness2) and create the url (eg https://awesomebusiness2-my.sharepoint.com/_api/v2.0 ) 当用户连接您的检索器时,其租户的名称(例如awesomebusiness2)并创建url(例如https://awesomebusiness2-my.sharepoint.com/_api/v2.0

Question 2 问题2

You can get tenant url from Discovery Service, check Step 3 from OneDrive for Business authentication and sign in article. 您可以从Discovery Service获取租户URL,从OneDrive for Business身份验证中检查步骤3, 然后登录文章。 Discovery Service will return MyFiles node with serviceEndpointUri which is exactly what you need 发现服务将返回带有serviceEndpointUri的MyFiles节点,这正是您所需要的

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM