Specify Selected Sites via Graph Explorer

    Refer to the steps below to specify which sites the app can access.

    1. Go to , and click the profile icon to sign in.

      Clicking the profile icon.

      When the pop-up window appears, click Accept.

      ![Clicking "Accept".](/en/aos/faqs/auto-discovery/what-should-i-do-if-the-sitesfullcontrolall-permission-cannot-be-added-to-my-custom-app/images/image17.png "Clicking "Accept".")

    2. Refer to the steps below to search for sites that match your provided keywords.

      1. From the left navigation, click search for a SharePoint site by keyword.

        ![Clicking "search for a SharePoint site by keyword".](/en/aos/faqs/auto-discovery/what-should-i-do-if-the-sitesfullcontrolall-permission-cannot-be-added-to-my-custom-app/images/image18.png "Clicking "search for a SharePoint site by keyword".")

      2. Under the Modify permissions tab, ensure that Sites.Read.All or Sites.ReadWrite.All permissions are granted. If not, click Consent to grant the permissions.

        ![Configuring permissions under the "Modify permissions" tab.](/en/aos/faqs/auto-discovery/what-should-i-do-if-the-sitesfullcontrolall-permission-cannot-be-added-to-my-custom-app/images/image19.png "Configuring permissions under the "Modify permissions" tab.")

      3. Replace the text after search= with the desired site name. Take the screenshot below as an example.

        An example of specifying a site name.

      4. Click Run query. Then, check the response result and note down the site ID value that matches the position of the red box in the screenshot below. The site ID value will be used in the following steps.

        A sample of the site ID value in a response.

    3. Use the following API call to grant the FullControl permission for your app to access a specific site.

      1. Change the request method to POST.

      2. Enter the following URL in the address bar, replacing {site-id} with the site ID value obtained in the previous step.

        https://graph.microsoft.com/v1.0/sites/{site-id}/permissions

        A sample of the POST request for a specific site.

      3. In the Request body text box, enter the following JSON, replacing {app-id} and {app-name} with the custom app's client ID and display name.

        {

        "roles": [ "fullcontrol" ], "grantedToIdentities": [ { "application": { "id": "{app-id}", "displayName": "{app-name}" } } ]

        }

        A sample of the Request body content.

      4. Under the Modify permissions tab, ensure that the Sites.FullControl.All permission has been granted. If not, click Consent to grant the permissions.

        ![Configuring permissions under the "Modify permissions" tab.](/en/aos/faqs/auto-discovery/what-should-i-do-if-the-sitesfullcontrolall-permission-cannot-be-added-to-my-custom-app/images/image24.png "Configuring permissions under the "Modify permissions" tab.")

      5. Click Run query to execute the request. A successful execution indicates that the specified site operation is complete.

        A sample of a successful execute.