Search code examples
sharepoint-2007wss-3.0

WSS 3.0 Feature- Check if User is Farm admin


I am developing a sharepoint feature that should allow only Farm admin to delete a sitecollection. In SiteDeleting event, i need to chech if the user deleting is farmadmin. How should i do that? I got a property to check if user is webadmin(properties.Web.UserIsWebAdmin) or siteadmin(properties.Web.UserIsSiteAdmin) but how to check if the user is farm admin ?

Any help is much appreciated..


Solution

  • SPFarm farm = SPFarm.Local;
    farm.CurrentUserIsAdministrator();
    

    These classes reside in Microsoft.SharePoint.Administration namespace. More on CurrentUserIsAdministrator or SPFarm class on MSDN.