Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Friday, August 12, 2011

Remove "View All Site Content" link for anonymous users in Sharepoint Foundation 2010

1.Go to "Site Actions" ==> "Site Settings"
2.Under Galleries, click on "Master Pages"
3.Select default.master and select “Edit in Microsoft Office SharePoint Designer”.
4.In “Design” view locate “View All Site Content” on the left-hand-site navigation bar and click on it.
5.Go to “Code” view. You will see the following code highlighted:



” AccessKey=”<%$Resources:wss,quiklnch_allcontent_AK%>”/>


6.Change the PermissionString attribute value of the Sharepoint:SPSecurityTrimmedControl XML element from ViewFormPages to BrowseDirectories.
7.Save the default.master. If you login as an anonymous user you will not see the “View All Site Content” link. However when authenticated you will see this option.

Monday, January 24, 2011

Checking to see if a list exists in SharePoint 2010

The most common way to do this is by using a try/catch block when you try to use the indexer on SPListCollection. Well, I am pleased to tell you about a new method I discovered on SPListCollection that really made my day. The new TryGetList method takes the name of a list and will get this, return a null if the list doesn’t exist. Take a look at this code.

using (SPSite siteCollection = new SPSite("http://moss-server"))
{
SPList myCustomList = siteCollection.RootWeb.Lists.TryGetList("MyCustomList");
// doesn't throw exception!
if (myCustomList != null)
{
// do something

}
}