cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ntt56k4
Helper V
Helper V

Rest api to hide document library

Hello folks,

 

can someone show me how to hide document library folder using rest api? 

thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @ntt56k4,

 

Can you share a screenshot of your setup? Might be something else which is causing it to fail. Do you get an error in your flow? If so, please share that as well.

 

Unfortunately, I am unable to reproduce your issue on my tenant. I am able to hide a document library as well with the same flow setup.

 

Below is an example to demonstrate. 

 

1. A Document Library called HiddenDocLib is shown in the Site Contents.

 

before_hidden.png

 

2. I run the same flow for that Doc Lib.

 

hidelibrary.png

 

3. The Doc Lib is hidden after the flow run

 

after_hidden.png

View solution in original post

6 REPLIES 6
Expiscornovus
Super User
Super User

Hi @ntt56k4,

 

Just to double check. When you mean hiding do you mean remove it as a link from (for example the Quick Launch) navigation? 

 

Or do you mean removing access for specific users or groups?

I would like to completely hide the library from anyone seeing it when they go to the site. I am not looking to remove permission or access just simply hide from viewing. I would like to use rest api so no other admins can go in and reset the view to see the folder. The link below shows you how to hide list but I cant seem to replicate it to hide document library. 

http://fdi-sharepoint.e-monsite.com/blog/javascript/sharepointhidelistwithrest.html

 

https://www.codesharepoint.com/rest-api/set-list-hidden-in-sharepoint-using-rest-api

Expiscornovus
Super User
Super User

Hi @ntt56k4,

 

The solution is in your second link. You can set the hidden property of your list to true.

 

Below is an example how you could do that via POST request in a Send an HTTP request to SharePoint action.

 

Headers

{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose",
  "If-Match": "*",
  "X-HTTP-Method": "MERGE"
}

 

Body

{
  "__metadata": {
    "type": "SP.List"
  },
  "Hidden": true
}

 

setlisttohidden.png

Thanks but unfortunately this method only works for sharepoint list and not document library. The flow failed when I put the document library folder name in it. I am not sure why. 

Expiscornovus
Super User
Super User

Hi @ntt56k4,

 

Can you share a screenshot of your setup? Might be something else which is causing it to fail. Do you get an error in your flow? If so, please share that as well.

 

Unfortunately, I am unable to reproduce your issue on my tenant. I am able to hide a document library as well with the same flow setup.

 

Below is an example to demonstrate. 

 

1. A Document Library called HiddenDocLib is shown in the Site Contents.

 

before_hidden.png

 

2. I run the same flow for that Doc Lib.

 

hidelibrary.png

 

3. The Doc Lib is hidden after the flow run

 

after_hidden.png

I finally got it to work. Not sure what was wrong but it is working now. Really appreciate your help. 

 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (1,712)