How to Hide List or Document Library With SharePoint Designer 2010

No.of Views2813
Bookmarked1 times
Downloads 
Votes0
By  André Lage   On  20 Nov 2010 04:11:48
Tag : SharePoint , Design and Customization
I receive a lot of question and hits about how to Hide Lists from Browser, well I have a article already talking about this topic but was with SharePoint Designer 2010
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

 In this article i will discuss ,How to Hide List or Document Library With SharePoint Designer 2010 using ECMAScript. Because I receive a lot of question and hits about how to Hide Lists from Browser, well I have a post already talking about this topic but was with SharePoint Designer 2010.at the same time this not a complex task as well.

Now I want to make a update on how we can achieve this using the new tools and services from SharePoint 2010, there are multiple ways to make this update but I will explain using Microsoft SharePoint Designer 2010 and ECMAScript.
You can download Microsoft SharePoint Designer 2010 is free and is a excellent tool for administration and customization of your SharePoint Sites.

For this example we need to select the List or document Library to Hide, in this case I choose “Form Templates” open the SharePoint Designer 2010 and select the SharePoint site where the List/Document Library are.

On the Left side of your window you will see the option “Lists and Libraries” select the Document Library “Forms Templates” and right click selecting “List Settings”.

 

Image Loading
Image Loading

In the List Settings of the Library “Forms Templates” you will have a option in “General Settings” check option “Hide from Browser”

Image Loading

Ok, done is updated and is not visible on the browser. 

Image Loading

When we click on the button “Hide List” the script will update the List and Hide from Browser and will return his current state.

Result of script

Image Loading

Update List to Hide from Browser Using ECMAScript

To use this option you will need to be Shure you are using the Support file “SP.js” there is the Client Object Model for the ECMAScript API. First we need to add the HTML Form Web Part, edit WebPart and select the option “Source Editor” and add the following script:

ECMAScript

<script type="text/javascript">function GetSiteTitle() {var clientContext = new SP.ClientContext.get_current();var oWebsite = clientContext.get_web();
                targetList = oWebsite.get_lists().getByTitle('Form Templates');
            targetList.set_hidden(true);
            targetList.update();

                clientContext.load(targetList);

                clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
            }function onQuerySucceeded() {var listInfo = '';

                    listInfo += 'Is List Hidden: ' + targetList.get_hidden() + '\n';
                alert(listInfo);
            }function onQueryFailed(sender, args) {
                alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
            }
                </script>

Then we have to call function like following to button.

<input id="Button1" type="button" value="Hide List" onclick="GetSiteTitle()" />

Well, like I say before we have a lot of services and different ways to do the same thing, the most difficult is to know what I will use.

Conclusion

In this article we have discussed,How to Hide List or Document Library With SharePoint Designer 2010 with ECMAScript.

 
Sign Up to vote for this article
 
About Author
 
André Lage
Occupation-Not Provided
Company-Not Provided
Member Type-Senior
Location-Portugal
Joined date-09 Jun 2010
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top