SharePointAds TextOnly

Tuesday, 18 May 2010

Sharepoint 2010: Remove 'All Site Content' and ‘Recycle Bin’ link

You can remove 'All Site Content' and ‘Recycle Bin’ link from sharepoint site by doing some change in master pages. Follow the following steps to remove both links from every pages.
  1. Open ‘v4.master’ file from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL (If you have only MOSS then in \12\TEMPLATE\GLOBAL ) or If you are using your custom master page then edit your custom master page.
  2. Find </head> , above </head> add following code

Save the changes in file. Now it will affect on every

Monday, 3 May 2010

Populate all Sharepoint Document Library names which has my custom Content types

Today I populated all document library names which has my custom content type in drop down list control in web part.
(So before start further, I am assuming that you have created any document library with custom content type in visual studio 2010.)
Lets starts with creating simple web part template in VS 2010 and on user control page (in .ascx) add dropdown control with name ' ddlCategory '

< asp : DropDownList ID ="ddlCategory" runat ="server" > </ asp : DropDownList >

and on usercontrol.ascx.cs page, add following function code on ' page_load '

public void PopulateDocNames()
ArrayList listWithMyCT = new ArrayList();
using (SPSite objSite = new SPSite("http://YOURSITE:PORT/"))
using (SPWeb objWeb = objSite.OpenWeb())
foreach (SPList list in objWeb.Lists)
if (list is SPDocumentLibrary && list.ContentTypes["Custom_Content_Type"]!= null)
ddlCategory.DataSource = listWithMyCT;

Note: Change YOURSITE:PORT and Custom_Content_Type with your site URL with port and your custom content type name.