As you probably know Sharepoint supports WebDAV protocol. It allows you to connect to Sharepoint site via regular Windows Explorer: open My Computer > right click on the area under all drives > Choose Add a network location in context menu:
In the opened window you have to specify address of the site and Exporer will show all document libraries, sub sites and folders created for specified site. This functuionality works via WebDAV protocol. Sometime we don’t want to show all these folders to end users. In this case we may hide the folder like we do it for regular Windows folders on the local file system:
Important to note that like in case with regular Windows folder when we hide Sharepoint folder via WebDAV it affects all users which open the same site via network location (however hiding folders there doesn’t affect web interface view, i.e. they still will be shown in the browser). When you hide folder from the folder property the following PROPPATCH HTTP request is sent to the server:
PROPPATCH http://example.com/test/test HTTP/1.1
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?><D:propertyupdate xmlns:D="DAV:" xmlns:Z="urn:schemas-microsoft-com:"><D:set><D:prop><Z:Win32FileAttributes>00000010</Z:Win32FileAttributes></D:prop></D:set></D:propertyupdate>
If we will check folder’s properties using the following console utility:
We will find that when we set Hidden attribute for the folder vti_winfileattribs property is changed from 00000010 to 00000012 value. With this information it is quite simple to hide folder for network location interface programmatically. The only thing which we need to do is to set vti_winfileattribs property for the folder:
After that it will be hidden when site is displayed via network location.