Taylohtio/CustomNavigationProvider/CustomNavigationCommon/WebPropertyHelper.cs

37 lines
1018 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace Taloyhtio.CustomNavigationCommon
{
public static class WebPropertyHelper
{
public static void Set(SPWeb site, string propertyName, string propertyValue)
{
site.Properties[propertyName] = propertyValue;
site.Properties.Update();
}
public static string Get(SPWeb site, string propertyName)
{
if (site.Properties.ContainsKey(propertyName))
{
return site.Properties[propertyName];
}
return string.Empty;
}
// Remove doesn't work on Properties - only on AllProperties
// public static void Remove(SPWeb site, string propertyName)
// {
// if (!site.Properties.ContainsKey(propertyName))
// {
// return;
// }
// site.Properties.Remove(propertyName);
// }
}
}