Click here to Skip to main content
15,881,248 members
Articles / Productivity Apps and Services / Sharepoint

Site Property Management (SharePoint 2010)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
11 Jul 2010CPOL4 min read 49.4K   712   14  
Provides an administrative UI to manage custom properties for a SharePoint site
//
//	MngSiteProperties.cs - © Questech Systems
//	This notice must stay intact for use. Not for resale.
//
using System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;

using Microsoft.SharePoint;
using Microsoft.SharePoint.ApplicationPages;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Utilities;

namespace QuestechSystems.SharePoint.ApplicationPages
{
    public partial class MngSiteProperties : WebAdminPageBase
    {
        private const string JSBlockKeyMngSiteProperties = "JSBlockKeyMngSiteProperties";
        private const string JSBlockMngSitePropertiesFormatString = @"var ADD_SITE_PROPERTY_URL = ""{0}"";";

        protected void Page_Load(object sender, EventArgs e)
        {
            ClientScriptManager cs = Page.ClientScript;

            if (!cs.IsClientScriptBlockRegistered(typeof(Page), JSBlockKeyMngSiteProperties))
            {
                string scriptBlock = String.Format(JSBlockMngSitePropertiesFormatString, Utility.GetAddSitePropertyUrl());
                cs.RegisterClientScriptBlock(typeof(Page), JSBlockKeyMngSiteProperties, scriptBlock, true);
            }

            ArrayList keyList = new ArrayList();
            foreach (string key in this.Web.AllProperties.Keys)
            {
                keyList.Add(key);
            }

            keyList.Sort();
            ArrayList propertyList = new ArrayList();
            foreach (string key in keyList)
            {
                propertyList.Add(new { Name = key, Value = this.Web.GetProperty(key).ToString() });
            }

            SitePropertiesGridView.DataSource = propertyList;
            SitePropertiesGridView.DataBind();
        }


        protected override bool RequireSiteAdministrator
        {
            get
            {
                return true;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Canada Canada
A Microsoft Certified Professional Developer and Technology Specialist.

Experience and expertise in SharePoint 2016 / 2013 / 2010 / 2007.

Role ranges from a developer in a multi-person team to a solution consultant with expert-level skills, leading a project to completion status.

Proven experience working effectively in a team environment and a self-managed environment.

Comments and Discussions