Skip to main content


Showing posts from August, 2012

Hide buttons control from ribbon for specific list

Hi ,

I want to hide "New Folder" button from ribbon of my library "Shared Documents" for site "SP2010-01".

To hide this button from ribbon for a Shared Documents, You must write this code :

using (SPSite site = new SPSite("http://SP2010-01"))
using (SPWeb web = site.OpenWeb())
SPList list = web.Lists.TryGetList("Shared Documents");
web.AllowUnsafeUpdates = true;
SPUserCustomAction actionView = list.UserCustomActions.Add();

StringBuilder newurl = new StringBuilder();
newurl.AppendLine("     <CommandUIDefinitions>");
//Provide Location ID to hide the button
newurl.AppendLine("        <CommandUIDefinition Location=\"Ribbon.Documents.New.NewFolder\">");
newurl.AppendLine("        </CommandUIDefinition>");
newurl.AppendLine("    </CommandUIDefinitions>");


DateTimeControl is not showing it’s calendar in proper format

Some time we have to create our own customized asp form or visual web part or simple web parts where we use SharePoint’s Date Time Control . Some time that control works properly but some time this control does not show calendar in proper format as we see in SharePoint. Control should show calendar like :

But instead of the format, It shows like this :

If you want to change this format for default format you have to write this code: