Hide SharePoint 2007 List Toolbar buttons and Menu Items

Got a requirement to Hide SharePoint toolbar buttons (E.g. “New”, “Upload”), Menu Items (E.g. “Upload Multiple Files”, “Alert Me”) from all document libraries of a SharePoint 2007 site collection. If its is for just a single document library, this can be achieved by wring Javascript-CSS, place it in Content Editor web part…

Read more

Attach Event Receiver to Specific List Programmatically in SharePoint 2010

Recently, developed an Event Receiver to set Item Level permissions based on the list field “Visible to Visitors”. Event receiver binds with all document libraries using ListTemplateId element in Elements.xml.  Event Receiver to Set Item Level Permissions based on List Column Value How to Associate an Event Receiver with a List Programmatically…

Read more

Event Receiver to Set Item Level Permissions based on List Column Value

The requirement is to Set Item Level Permission on Document Library Items based on the field in the document library “Visible to Visitors”. The field “Visible to Visitors” is a Checkbox. Technically, When this column set to True, We’ll have to do nothing. When this column set to False, we’ll have to…

Read more

How to Add Web Parts to the Page Programmatically?

Requirement is to add OOTB and Custom web parts to a web part page programmatically via features. I’m sharing the code snippets: To Add Out Of The Box Web Parts: (E.g. Content Query Web Part, Content Editor, Page Viewer Web Part, etc): Add Page Viewer web part: Programmatically add ListView webpart from:…

Read more

Event Receivers vs Workflows – Decide Which One to Use

As SharePoint Event Receivers & SharePoint workflows have a lot of similarities, Many people stuck on deciding which one to go with: Event Receiver or Workflow? event receiver vs. workflow in SharePoint is always tricky to decide. Differences Between SharePoint Event Receivers and SharePoint Workflows: 1. Event handlers Can’t be manually initiated…

Read more

How to Create – Update – Delete SharePoint Views Programmatically?

Often in development we may have to deal with SharePoint Views programmatically. Here I’m sharing the code snippets from my recent project to handle views programmatically. Creating a New View Programmatically: Add/Remove fields to an existing View Programmatically: Get the Fields from View Programmatically: Delete Existing View Programmatically: PowerShell Script to Create…

Read more

Restrict File Types in SharePoint Document Library Upload using Event Receiver

Requirement: In a Project collaboration SharePoint site, had a requirement to allow users to upload only PDF files to a Document Library and prevent all other files from being uploaded. Solution: Our requirement is basically to prevent files from being uploaded other than PDF, isn’t it? So let’s jump to visual studio…

Read more