how to hide the views from document library or list. I don't want this views should be seen to any staff members except my team. Is there possible way to do this?
7 Answers
Another option is to changed the View Name to a nonbreaking space, which SharePoint accepts as a valid name. To get the nonbreaking space press and hold Alt
, then type 0160
on the numeric keyboard, and finally release Alt
.
You then need to remember the URL name of the view to get to it. Like others have said, since this is not permissions based, it is not fool proof if you really don't want people getting to the data in the view.
You can't hide a view from some users and not others, but there is a way to hide a view from everyone, and then you can let your team know that, though hidden, the view still exists.
From the list settings page, choose "Per-location view settings", then select the views you want to hide and click "Remove". Those views will no longer show up in the view selector dropdown, but navigating to the URL of the view, whether by typing it manually, clicking an existing link in a page or document, or via a browser bookmark, will still work.
If you are concerned that someone may have already created a browser bookmark to this view before you hid it, you can always change the URL of that view in List Settings after you hide it, and then share this new URL with your team.
You could even add an item to a "Quick Links" list web part on a page, with a hyperlink to the hidden view, and break permission inheritance on that single list item, so that only your team can see the link.
Note that since this is accomplished by hiding, and not by permissions, it may still be possible for a determined individual to discover its existence. Think of a spare key taped to the back of your electric meter - nobody knows it's there, but if your neighbor (staff member outside your team) happens to see your teenager retrieve the key (see your team member's browser open on the view), they might find the hiding spot later (take note of the URL), and watch your TV while you're at work (see the information in the hidden view). But it's still better than pointing the TV directly at the living room window (the view's existence being explicitly broadcast to the world).
-
7
This solution just hides the links to the view :
- Edit the Document Library Page (Settings Cog, "Edit Page").
- Edit The Document Library Web Part.
- In the "Miscellaneous" section, check "Disable view selector menu".
- Click OK, and Save the Page.
Credit where credit is due, I found this solution here.
SharePoint view has a property SPView.Hidden. If you set this property to true
, this view will be not visible for other users, but it still can be opened using the direct URL.
You can set this property using PowerShell with Server Site Object Model or CSOM, or using JavaScript.
Yet another option is to not use views at all.
You can create a separate pages library which you make available (by permission) only to your team.
There you make a blank page per "view" where you add a webpart for the list you want to show. Configure the "view" settings through the webpart properties.
This is more secure because it does not "hide" but uses permissions.
Well as mentioned by @ECM4D, one can do that using CSOM which a convenient way i.e create a CSOM based console app and use the following code snippet to hide the unwanted views.
private static void SetViewsToHidden(ClientContext clientContext, List oList, Guid viewGuid)
{
try
{
View viewToHide = oList.GetView(viewGuid);
clientContext.Load(viewToHide);
clientContext.ExecuteQuery();
viewToHide.Hidden = true;
viewToHide.Update();
clientContext.ExecuteQuery();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Once you succesfully do that. The view will be hiddent from the ribbon and from the list view header where all the views are populated. You can reach these view using just the URL.
create a view just for your team. keep this link and don't give it out to anyone other than your team. then add a content editor web part, in the CEWP HTML source add the code below to hide the views.
<style>
.ms-pivotControl-container{display:none;}
.ms-InlineSearch-DivBaseline{display:none;}
.ms-list-addnew{display:none;}
< /style>