MANOJ PATEL

MANOJ PATEL

  • NA
  • 8
  • 4.3k

How to use graph api to get columns of item from sharepoint

Oct 4 2019 10:40 AM
I have a sharpoint documentLibrary "account". I have custom attribute IsAuthorized bool field.
This document library has a folders "Microsoft", "TCS"
 
I have uploaded 2 files under the folder "Microsoft" & set the IsAuthorized = false and 1 file is added under TCS folder with isAuthorized = true. 
 
Now i want to get those two files with IsAuthorized field from folder name = "Microsoft" using Graph API.
 
Native Get Call: 
I am able to get both the details via native rest calls as below:
https://manojpatel20dec.sharepoint.com/_api/Web/GetFolderByServerRelativePath(decodedurl='/account/Microsoft')/Files?$expand=Properties
 
Graph Get Call:
I am able to fetch the folder and exact 2 items from it with below get query but unable to get custom fields.
 https://graph.microsoft.com/v1.0/sites/manojpatel20dec.sharepoint.com/drives/account/root:/Microsoft:/children
Alternatively I tried: Below query gave me 3 files with fields but did not filter the folder = Microsoft even when i added &filter query string. Filter was ignored.
https://graph.microsoft.com/v1.0/sites/manojpatel20dec.sharepoint.com/lists/account?select=id,lastModifiedDateTime,lastModifiedBy&expand=items(expand=fields(select=IsAuthorized)) 
 
What should be done to get only 2 files and fields in one go using Graph API?

Answers (4)