How to access a SharePoint site in another tenant

Oshadhi Gayangika 1 Reputation point
2022-04-12T07:57:18.403+00:00

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 'XYZenter 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: ******-4c****8-fc*****0\r\nCorrelation ID: c8*****2-******- \r\nTimestamp: 20****15*****\",\"error_codes\":[***],\"timestamp\":\"2022**** 15*****\",\"trace_id\":\"9*****6-***4-****8-fc*****\",\"correlation_id\":\"c*****12-******-*******a1\",\"error_uri\":\"https://*******/error?code=******6\"}"

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

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,680 questions
{count} votes

3 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 31,606 Reputation points Microsoft Vendor
    2022-04-14T07:13:53.213+00:00

    Hi @Oshadhi Gayangika ,
    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.



  2. Rob Windsor 1,956 Reputation points
    2022-04-29T12:22:12.25+00:00

    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.


  3. Oshadhi Gayangika 1 Reputation point
    2022-05-06T08:17:45.33+00:00

    @Rob Windsor May I know the process of requesting access from the client tenant