Sunday, April 1, 2018

Authorize Postman to access SharePoint

Authorize Postman to access SharePoint
1. Register Add-In
2. Grant Permissions to Add-In
3. Generate the Access Token
4. Access the SharePoint resource

1. Register Add-In:-
-------------------------
Open below url to create Add-in.
https://sharepointonline01.sharepoint.com/sites/dev2/_layouts/15/appregnew.aspx
Generate Client ID, Client Secret ID and give required as shown below.
After click on Crete button copy Client ID and Client Secret ID in clipboard will use in next step.
2. Grant Permissions to Add-In:-
----------------------------------------
Open below url to give permission to our add-in.
https://sharepointonline01.sharepoint.com/sites/dev2/_layouts/15/appinv.aspx
Enter Client ID in App Id text and click on lookup button to retrieve add-in details.
In permission Request XML text box type below XML syntax as it is to give read permission.

<AppPermissionRequests AllowAppOnlyPolicy="true">
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Read" />
</AppPermissionRequests>
After click on 'Create' button then click on 'Trust It' button to trust it.
Tenant Id required in next step, so go to below url to copy Tenant Id. In my case the highlighted text is Tenant Id.
https://sharepointonline01.sharepoint.com/sites/dev2/_layouts/15/appprincipals.aspx?Scope=Web

Tenant Id : caf8f8f2-6ab2-49eb-b6db-2e2f43603ec1

3. Generate the Access Token:-
--------------------------------------
Open Postman tool and perform POST method.
URL : https://accounts.accesscontrol.windows.net/<TenantID>/tokens/OAuth/2 
URL : https://accounts.accesscontrol.windows.net/caf8f8f2-6ab2-49eb-b6db-2e2f43603ec1/tokens/OAuth/2

Apply the below configurations in HEADER.
KEY : Content-Type
VALUE : application/x-www-form-urlencoded

Apply the below configurations in BODY.
KEY : grant_type
SYNTAX : client_credentials
VALUE : client_credentials

KEY : client_id
SYNTAX : ClientID@TenantID
VALUE : 2141cd97-d779-4962-a622-9bbdfb581f0e@caf8f8f2-6ab2-49eb-b6db-2e2f43603ec1

KEY : client_secret
SYNTAX : ClientSecret
VALUE : faAXsOGXcuHCIDYHHt9uFnjAL4pSCJ3vj09cNNZgnBM=

KEY : resource
SYNTAX : resource/SiteDomain@TenantID
VALUE : 00000003-0000-0ff1-ce00-000000000000/sharepointonline01.sharepoint.com@caf8f8f2-6ab2-49eb-b6db-2e2f43603ec1

In this Body configuration this "00000003-0000-0ff1-ce00-000000000000" resource value is common for all SharePoint online product. 
Click on Send button to get access token from SharePoint.
{
    "token_type": "Bearer",
    "expires_in": "3599",
    "not_before": "1522592768",
    "expires_on": "1522596668",
    "resource": "00000003-0000-0ff1-ce00-000000000000/sharepointonline01.sharepoint.com@caf8f8f2-6ab2-49eb-b6db-2e2f43603ec1",
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkZTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyIsImtpZCI6IkZTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvc2hhcmVwb2ludG9ubGluZTAxLnNoYXJlcG9pbnQuY29tQGNhZjhmOGYyLTZhYjItNDllYi1iNmRiLTJlMmY0MzYwM2VjMSIsImlzcyI6IjAwMDAwMDAxLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMEBjYWY4ZjhmMi02YWIyLTQ5ZWItYjZkYi0yZTJmNDM2MDNlYzEiLCJpYXQiOjE1MjI1OTI3NjgsIm5iZiI6MTUyMjU5Mjc2OCwiZXhwIjoxNTIyNTk2NjY4LCJpZGVudGl0eXByb3ZpZGVyIjoiMDAwMDAwMDEtMDAwMC0wMDAwLWMwMDAtMDAwMDAwMDAwMDAwQGNhZjhmOGYyLTZhYjItNDllYi1iNmRiLTJlMmY0MzYwM2VjMSIsIm5hbWVpZCI6IjIxNDFjZDk3LWQ3NzktNDk2Mi1hNjIyLTliYmRmYjU4MWYwZUBjYWY4ZjhmMi02YWIyLTQ5ZWItYjZkYi0yZTJmNDM2MDNlYzEiLCJvaWQiOiI0NzdkMmFmZC1kYzMyLTRmMTUtOWFjMi1lYTE1YzFhODJjNzQiLCJzdWIiOiI0NzdkMmFmZC1kYzMyLTRmMTUtOWFjMi1lYTE1YzFhODJjNzQiLCJ0cnVzdGVkZm9yZGVsZWdhdGlvbiI6ImZhbHNlIn0.wGBEO8JkGv9eCbza4CIivJve32l-96rH64rsgmezdLLUo2JZ_aiqGQHI545Z0pDRG4JtghrQIrXJ2NH643wKUjZl__UlX6wkOTu8gEkkUCbU3EtX0I3dKdOFAQl-ehhDAOcwp8oBys3Vw89xseuKkVWePGT-AtJP-sEOk-U3CQuj0w7Ft-BwjXmapcIF5em9kwPa5rPza7teOYdk6qe56LQavZohV_31yykPhWHdNds2jxAUHjWL_xKS3ffidtihTn57z8zvonFwKomDuVdwJrpkOmk4x7ry_wsOLMP5q5-N46yMbe8hZFAWE8k2l5mN4x66LD3MFThPbDAfOvqiMQ"
}

4. Access the SharePoint resource:-
--------------------------------------------
Open postman and perform POST method to read SharePoint site title using access token.

URL : https://sharepointonline01.sharepoint.com/sites/dev2/_api/web?$select=Title

Apply configurations in HEADER.
KEY : Authorization
SYNTAX : <token_type> <access_token>
VALUE : Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkZTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyIsImtpZCI6IkZTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvc2hhcmVwb2ludG9ubGluZTAxLnNoYXJlcG9pbnQuY29tQGNhZjhmOGYyLTZhYjItNDllYi1iNmRiLTJlMmY0MzYwM2VjMSIsImlzcyI6IjAwMDAwMDAxLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMEBjYWY4ZjhmMi02YWIyLTQ5ZWItYjZkYi0yZTJmNDM2MDNlYzEiLCJpYXQiOjE1MjI1OTI3NjgsIm5iZiI6MTUyMjU5Mjc2OCwiZXhwIjoxNTIyNTk2NjY4LCJpZGVudGl0eXByb3ZpZGVyIjoiMDAwMDAwMDEtMDAwMC0wMDAwLWMwMDAtMDAwMDAwMDAwMDAwQGNhZjhmOGYyLTZhYjItNDllYi1iNmRiLTJlMmY0MzYwM2VjMSIsIm5hbWVpZCI6IjIxNDFjZDk3LWQ3NzktNDk2Mi1hNjIyLTliYmRmYjU4MWYwZUBjYWY4ZjhmMi02YWIyLTQ5ZWItYjZkYi0yZTJmNDM2MDNlYzEiLCJvaWQiOiI0NzdkMmFmZC1kYzMyLTRmMTUtOWFjMi1lYTE1YzFhODJjNzQiLCJzdWIiOiI0NzdkMmFmZC1kYzMyLTRmMTUtOWFjMi1lYTE1YzFhODJjNzQiLCJ0cnVzdGVkZm9yZGVsZWdhdGlvbiI6ImZhbHNlIn0.wGBEO8JkGv9eCbza4CIivJve32l-96rH64rsgmezdLLUo2JZ_aiqGQHI545Z0pDRG4JtghrQIrXJ2NH643wKUjZl__UlX6wkOTu8gEkkUCbU3EtX0I3dKdOFAQl-ehhDAOcwp8oBys3Vw89xseuKkVWePGT-AtJP-sEOk-U3CQuj0w7Ft-BwjXmapcIF5em9kwPa5rPza7teOYdk6qe56LQavZohV_31yykPhWHdNds2jxAUHjWL_xKS3ffidtihTn57z8zvonFwKomDuVdwJrpkOmk4x7ry_wsOLMP5q5-N46yMbe8hZFAWE8k2l5mN4x66LD3MFThPbDAfOvqiMQ

63 comments:

  1. This procedure will work for the online site, how about SharePoint 2013 (on - perm) site

    ReplyDelete
  2. This worked for me! Thank you so much!

    ReplyDelete
  3. The bearer token that is give is only valid for 12 hours, is it possible to make it last longer?

    ReplyDelete
  4. The writer has outdone himself this time. It is not at all enough; the website is also utmost perfect. I will never forget to visit your site again and again. https://123movies-website.org

    ReplyDelete
  5. Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC. https://soap2day.digital

    ReplyDelete
  6. This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself.. https://megashare-website.com

    ReplyDelete
  7. It’s appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or advice. Perhaps you could write next articles referring to this article. I desire to read even more things about it! https://soap2dayy.co

    ReplyDelete
  8. This is highly informatics, crisp and clear. I think that everything has been described in systematic manner so that reader could get maximum information and learn many things. https://solarmovies.cloud

    ReplyDelete
  9. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. https://gomovies-sc.com

    ReplyDelete
  10. nice bLog! its interesting. thank you for sharing.... https://primewire.today

    ReplyDelete
  11. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free https://xmovies8.one

    ReplyDelete
  12. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. https://onlinemovie25.com

    ReplyDelete
  13. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. https://projectfreetv.space/

    ReplyDelete
  14. I think that thanks for the valuabe information and insights you have so provided here. https://y-ymovies.com

    ReplyDelete
  15. Wonderful article. Fascinating to read. I love to read such an excellent article. Thanks! It has made my task more and extra easy. Keep rocking https://movietube.video

    ReplyDelete
  16. Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as  https://thecouchtuner.one

    ReplyDelete
  17. Hey, I am so thrilled I found your blog, I am here now and could just like to say thank for a tremendous post and all round interesting website. Please do keep up the great work. I cannot be without visiting your blog again and again. https://vumoo.vip

    ReplyDelete
  18. You have performed a great job on this article. It’s very precise and highly qualitative. You have even managed to make it readable and easy to read. You have some real writing talent. Thank you so much. https://currentputlocker.site

    ReplyDelete
  19. Excellent blog! I found it while surfing around on Google. Content of this page is unique as well as well researched. Appreciate it. https://myvumoo.com

    ReplyDelete
  20. Great survey, I'm sure you're getting a great response https://newcouchtuner.site

    ReplyDelete
  21. Keep up the good work; I read few posts on this website, including I consider that your blog is fascinating and has sets of the fantastic piece of information. Thanks for your valuable efforts. https://the123movies.site

    ReplyDelete
  22. Keep up the good work; I read few posts on this website, including I consider that your blog is fascinating and has sets of the fantastic piece of information. Thanks for your valuable efforts. https://123-movies.site

    ReplyDelete
  23. I really like your writing style, great information, thankyou for posting. https://putlockertv.one

    ReplyDelete
  24. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. https://soaptoday.website

    ReplyDelete
  25. Remarkable article, it is particularly useful! I quietly began in this, and I'm becoming more acquainted with it better! Delights, keep doing more and extra impressive https://soaptoday.space

    ReplyDelete
  26. This article was written by a real thinking writer without a doubt. I agree many of the with the solid points made by the writer. I’ll be back day in and day for further new updates. https://thesolarmovies.space

    ReplyDelete
  27. Great post but I was wondering if you could write a little more on this subject? I’d be very thankful if you could elaborate a little bit further. Thanks in advance! https://123movies-to.space

    ReplyDelete
  28. I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. I thank you to help making people more aware of possible issues. https://1primewire.top

    ReplyDelete
  29. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work https://theprimewire.website

    ReplyDelete
  30. I am very happy to discover your post as it will become on top in my collection of favorite blogs to visit. UNITED STATES VISA REQUIREMENTS

    ReplyDelete
  31. I just want to let you know that I just check out your site and I find it very interesting and informative.. Canada Visitor Visa

    ReplyDelete
  32. Profit primarily prime quality items -- you can understand them all within: UNITED STATES TOURIST VISA

    ReplyDelete
  33. Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though. INDISK NØDVISUM

    ReplyDelete
  34. I can recommend primarily decent and even responsible tips, as a result, view it: BORANG PERMOHONAN VISA INDIA

    ReplyDelete
  35. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. Commercial Roofers

    ReplyDelete
  36. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. Visto Canada ETA

    ReplyDelete
  37. hi was just seeing if you minded a comment. i like your website and the thme you picked is super. I will be back. เคล็ดลับเล่นบาคาร่าออนไลน์

    ReplyDelete
  38. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... URGENT INDIA VISA

    ReplyDelete
  39. The most interesting text on this interesting topic that can be found on the net ... 토토커뮤니티

    ReplyDelete
  40. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. Visa USA

    ReplyDelete
  41. Amazing, this is great as you want to learn more, I invite you to This is my page. fusible interlining fabric

    ReplyDelete
  42. This content is simply exciting and creative. I have been deciding on an institutional move and this has helped me with one aspect. good iptv

    ReplyDelete
  43. For this web site, you will see our account, remember to go through this info. 토토사이트

    ReplyDelete
  44. Gives you the best website address I know there alone you'll find how easy it is. link pos4d

    ReplyDelete
  45. I recommend only good and reliable information, so see it: slot pragmatic

    ReplyDelete
  46. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. massagers hand held

    ReplyDelete

Featured Post

Sent Email in C#

Sent Email in C# : //Option 1: using S ystem; using System.Net.Mail; using System.Security; using System.Text; using System.Threading.T...

Popular posts