sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

How to find the tenant name

Open mirkori opened this issue 6 years ago • 4 comments

Category

  • [x] Question
  • [ ] Typo
  • [ ] Additional article idea

Question

In a SPO App-Only environment, what is the recommended way on how to find the tenant name ( tenantname.onmicrosoft.com ) or sharepoint url, if the tenant id is available?

Alternatively, is there a way to open a (CSOM) ClientContext to the sharepoint admin url, with only the tenant id available?

The other way around (find tenant id by name) is easy and can be done by checking the openid configuration of the tenant: https://login.microsoftonline.com/tenantname.onmicrosoft.com/v2.0/.well-known/openid-configuration

Happy for any input on this.

mirkori avatar Oct 12 '20 09:10 mirkori

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Oct 12 '20 09:10 ghost

This is not possible to get Tenant Name based on Id using CSOM as it's always need SharePoint site url to create ClientContext firstly.

And if the envrionment is using App Only Authentication, the registered application can be found in:

http://tenant.sharepoint.com/sites/sitename/_layouts/15/_layouts/15/AppInv.aspx

The Tenantname should be know at first.

Jerry0527 avatar Oct 15 '20 09:10 Jerry0527

This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open or submit a new issue.

ghost avatar Dec 29 '21 15:12 ghost

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

ghost avatar Jan 05 '22 18:01 ghost