question

OshadhiGayangika-8832 avatar image
0 Votes"
OshadhiGayangika-8832 asked RaytheonXie-MSFT commented

How to access a SharePoint site in another tenant

I want to upload files to a SharePoint site in another tenant(client's SharePoint site) using an azure application (application registered in our organization tenant).

I am getting this error

"{\"error\":\"unauthorized_client\",\"error_description\":\"AADSTS700016: Application with identifier '..............' was not found in the directory 'XYZ`enter code here`'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.\*\\nTrace ID: -4c8-fc0\\r\\nCorrelation ID: c82-- \\r\\nTimestamp: 20*15\",\"error_codes\":[],\"timestamp\":\"2022 15\",\"trace_id\":\"96-4-8-fc\",\"correlation_id\":\"c12--a1\",\"error_uri\":\"https:///error?code=****6\"}"



I am using a .net core application. Can someone help me?

sharepoint-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @OshadhiGayangika-8832 ,
I am currently doing some research on this issue, will let you know as soon as possible

0 Votes 0 ·
RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @OshadhiGayangika-8832 ,
The error message shows that the Application identifier is incorrect. I suspect that in your application, you have specified Client Secret instead of Client ID (aka App ID). This is why the authentication request contains incorrect Client ID and Azure AD fails to find the app, resulting in this error. Search for your app under Azure AD > App registrations and make sure you are using its client ID.

In Azure AD, the Client ID is always in GUID format, as highlighted below:
192966-image.png

In case, after configuring the correct Client ID you still get this error, you need to construct the below URL and provide it to the Global administrator of your tenant, who will have to consent after successfully signing in.

  https://login.microsoftonline.com/common/adminconsent?client_id=your_client_id


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.





image.png (9.8 KiB)
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RaytheonXie-MSFT I want to access my client's SharePoint site from my azure application which is in my tenant

0 Votes 0 ·

Hi, @RaytheonXie-MSFT my client ID is correct and as it says in the error msg my application is not in the XYZ tenant. I want to access a SharePoint site in XYZ tenant from my application

0 Votes 0 ·

Hi @OshadhiGayangika-8832 ,
Have you tried the solution I proposed?

If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Have a lucky day!

Thanks,
Raytheon Xie

0 Votes 0 ·

Hi @OshadhiGayangika-8832 ,
Did the answer help you? If you have any question about the issue, please feel free to reply.

0 Votes 0 ·

Hi @RaytheonXie-MSFT ,'
'
I will let you know. I am still in progress.

0 Votes 0 ·
RaytheonXie-MSFT avatar image RaytheonXie-MSFT OshadhiGayangika-8832 ·

Hi @OshadhiGayangika-8832 ,
If there's anything you'd like to know, don't hesitate to ask.

0 Votes 0 ·
RobWindsor-4651 avatar image
0 Votes"
RobWindsor-4651 answered RobWindsor-4651 commented

Is your Azure application configured to be multi-tenant? Single-tenant apps are only available in the tenant they were registered in, also known as their home tenant. Multi-tenant apps are available to users in both their home tenant and other tenants.

You can tell if your application configured to be multi-tenant by looking at the selected option under Supported account types in the Authentication page.


197744-image.png




If your application is configured to be single-tenant then you need to change it to be multi-tenant and you need an administrator in the client tenant to consent to any permission requests made by your application.


image.png (75.4 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RobWindsor-4651 yes my application is a single-tenant one. What I want to do is upload a file to our customer's SharePoint site using our app(Our app is registered in our tenant & customer's SharePoint site is in their tenant)

0 Votes 0 ·
RobWindsor-4651 avatar image RobWindsor-4651 OshadhiGayangika-8832 ·

@OshadhiGayangika-8832 As I mentioned in my answer, if your application is configured to be single-tenant then you need to change it to be multi-tenant and you need an administrator in the client tenant to consent to any permission requests made by your application. Otherwise your application cannot access the client tenant.

0 Votes 0 ·
OshadhiGayangika-8832 avatar image
0 Votes"
OshadhiGayangika-8832 answered RaytheonXie-MSFT commented

@RobWindsor-4651 May I know the process of requesting access from the client tenant

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@OshadhiGayangika-8832 An administrator in the client tenant needs to open a browser and navigate to https://login.microsoftonline.com/common/adminconsent?client_id=your_client_id where "your_client_id" is the Client Id of your Azure app. This will show the standard admin consent dialog. The admin needs to check the Consent of behalf of your organization checkbox and then click Accept.

199526-image.png




0 Votes 0 ·
image.png (134.7 KiB)

Hi @OshadhiGayangika-8832 ,
Does RobWindsor-4651's answer help you? If you have any question about the issue, please feel free to reply.

0 Votes 0 ·