I would like to read lists and contents in pages folder from SharePoint Online. I come across this post. But this uses Username and password. is there a way to read contents without using username/password? like using clientId./Secret or any token?

if yes, how to create those tokens or clientId/Secret and how to use them?

4 Answers 4


The information you need is answered right here: https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs with necessary links to do the app registration and code samples for usage.

The example there gives the registered app full control to all Site Collections. You should set this as low as needed.

For example, if you only need read permissions to a specific web, you would use the following permission request XML:

<AppPermissionRequests AllowAppOnlyPolicy="true">  
  <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" 
   Right="Read" />

The URL in the "Scope" parameter should not be replaced, this can be confusing for some. This is just to say what scope the permission applies to: tenant, site collection, web or list.

Note! When you do the registration, be sure to use an URL that corresponds to the permission you are granting.

If you wanted to give read permissions to the site https://contoso.sharepoint.com/sites/yoursite/subweb you would use the following link to do the registration: https://contoso.sharepoint.com/sites/yoursite/subweb/_layouts/AppRegNew.aspx

  • Thanks Rune. this helps
    – extractor
    Commented Apr 24, 2020 at 11:31

It is possible using the following steps

  1. Register an app using the '_layouts/15/appregnew.aspx' page .
  2. Set the permissions for the app using the '_layouts/15/appinv.aspx' page.
  3. Obtain an access token by providing the generated client id and client secret (You will need to also provide your tenant id in this step)
  4. Make the api call by passing the obtained access token as a bearer token.

API calls can be made using the same token till the token expiry . Once it is expired , you can generate a new token . It is a recommended practice to keep the token cached till its expiry and request for the new token only once it has expired .

Below is a very good article explaining the steps in detail.


  • Thakns Shaju. All the answers here are around same line. i will try them.
    – extractor
    Commented Apr 24, 2020 at 11:30

We can do using the Postman tool - here are the steps:

Please follow the below steps:

Step 1: - Register Add-In – SharePoint online:

  • Client Id – will get it from the SharePoint online page.


Step 2: Grant Permissions to Add-In – SharePoint online:

  • Client Secret – will get it from the SharePoint online page.


Step 3: Generate Realm and Access Token from Postman (refer to the below supporting article).

  • Realm (Tenant Id) – will get it from the postman tool
  • Access Token – will get it from the postman tool

Step 4: REST API "GET" successful operation (refer to the below supporting article)

Using the above Client Id, Client Secret,Realm (Tenant Id) and Access Token from the postman tool, perform a sample "GET" REST API query from the SharePoint online list.

Step 5: GENERATE CODE SNIPPETS (refer to the below supporting article)

On the successful GET operation result, go to the GENERATE CODE SNIPPETS option, there, we can generate code snippets in almost all popular languages, like C#, C, Java, PowerShell, etc.

Generate the code in C# language, then plugin (use that) that code into your actual project code file.

Code-Snippet - Postman-tool-SharePoint-online-REST-API13

For the details steps, refer to the below article:

In 4 steps access SharePoint online data using postman tool

  • Thanks Habi. I was looking for it via Client Content. But this definitley help me down the line.
    – extractor
    Commented Apr 24, 2020 at 11:30

Share previous tested demo to access SharePoint with add-in permission in a console application.

enter image description here

  • Thanks Lee. This is helpful
    – extractor
    Commented Apr 24, 2020 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.