Thursday, August 14, 2014

Snippets to create custom SharePoint forms/pages

Many times I create custom SharePoint forms in my solutions. More appropriate way is to create SharePoint form using InputFormSection. InputFormSection takes care of the layout and positioning of your controls. You can add InputFormControl containing controls under InputFormSection.

Add the following references in .aspx pages:

Container for InputFormSection:

Followings are some snippets of few common controls I use in custom SharePoint forms/pages:


Multiline Textbox



Radio button

Url Field

File Upload

People Picker


Tuesday, August 12, 2014

Sharepoint Selector Controls for custom administration pages

Sharepoint comes with four selector controls to choose destination elements for the operations.  These controls can be used in custom administration pages.  You can locate this controls under Microsoft.SharePoint.WebControls namespace.  To add selector controls you have include following page directive:


WebApplicationSelector control allow user to get or set the web application.


SiteAdministrationSelector control allow user to get or set the site collection.


WebAdministartionSelector allow user to gets or sets the Web.  The web selector requires that SiteSelector not be a null reference.  So you have to use SiteAdministartionSelector to use this control.


ListAdministrationSelector allow user to get or set the List or Document Library.  The List selector requires WebAdministartionSelector.  So if you want to use list selector then you have to use WebAdministartionSelector as well as SiteAdministrationSelector.

To get the selected values from above controls use CurrentItem property:

Friday, August 1, 2014

Get operating system name from HttpRequest

I was creating a HttpModule in SharePoint to track the request related data such as browser name and client platform. If you are tracking request related data then you must be familiar with System.Web.HttpBrowserCapabilities class. HttpBrowserCapabilities class enables the server to gather information on the capabilities of the browser that is running on the client. I was using HttpCapabilitiesBase.Platform Property to get the client operating system name. But for Windows platform it was returning "WinNt" instead of actual operating system name. After doing some research I noticed that Request.UserAgent returns operating system information along with operating system version number. 

Here is my code to get the Operating System name from Request.UserAgent

If you find more combinations please add it to comments section.