Wednesday, January 14, 2009

Checking for Central Web Application

Scenario:
I was writing a feature and I wanted to make sure that it get applied to Central Web Application only.

Solution:
SPWebApplication exposes a property 'IsAdministrationWebApplication', which can help you determine if it is Central Web Application.

Code:



if(!webApplication.IsAdministrationWebApplication)
throw new Exception("This feature can only be applied to CA");

0 comments: