0
votes

I tried to get files under "SitePages" document library in SharePoint site. "SitePages" folder has "webpart pages" type file wp.aspx and "sitepages" type file "sp.aspx". My request is

url: https://site_url/_api/web/getfolderbyserverrelativeurl(<folder_url>)/files

I am able to get wp.aspx but not sp.aspx. On further investigation i found out that sp.aspx is unpublished and saved as draft. If i publish sp.aspx i am able to get it from above API.

My question is how can we get unpublished files in above case using sharepoint rest api.

1

1 Answers

1
votes

I was newbie when i asked this question. Actually it is how works. If you created some page, then you have to publish it so that others can see that page. If it is unpublished it will be visible to only user who created it, same like checked out and checked in files. Since we are accessing these files using global admin credentials, he is not able to see unpublished files.