示例#1
0
        /// <summary>
        /// Load a string from the common properties list. Returns empty string if name does not exist
        /// </summary>
        /// <param name="name">Name of the property to retrieve</param>
        /// <param name="webApp"></param>
        /// <returns>Value corresponding to Name. Empty string if not found</returns>
        public static string Load(string name, SPWebApplication webApp)
        {
            return(FarmPropertyBag.Load(name));

            //if (_properties == null)
            //{
            //    ReloadProperties(webApp);
            //}

            //ConfigurationProperty prop = _properties[name];
            //if (prop == null)
            //{
            //    return "";
            //}
            //else
            //{
            //    return prop.DefaultValue.ToString();
            //}
        }
示例#2
0
 /// <summary>
 /// Save a name value pair to the common properties list using current sharepoint context
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 public static void Save(string name, string value)
 {
     FarmPropertyBag.Save(name, value);
 }
示例#3
0
 /// <summary>
 /// Load and decrypt an encrypted string from the common properties list. Pass in the web applicaton
 /// Note: this is used mainly for testing in the Common Properties Maintenance applicatoin. If you
 /// have a SharePoint context, use the version that doesn't require a webApp parameter.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="webApp"></param>
 /// <returns></returns>
 public static string LoadEncryptedString(string name, SPWebApplication webApp)
 {
     //return DecryptString(Load(name, webApp), webApp);
     return(DecryptString(FarmPropertyBag.Load(name), webApp));
 }
示例#4
0
 /// <summary>
 /// Encrypt and store a string into the common properties list for corresponding name, passing in appropriate web application
 /// NOTE: if you have a valid SharePoint context, use the version of this method that does not require the webApp parameter.
 /// This method is for testing with the Common Properties Maintenance application
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 /// <param name="webApp"></param>
 public static void StoreEncryptedString(string name, string value, SPWebApplication webApp)
 {
     //Save(name, EncryptString(value, webApp), webApp);
     FarmPropertyBag.Save(name, EncryptString(value, webApp));
 }
示例#5
0
        // private static ConfigurationPropertyCollection _properties = null;

        public static string Load(string name)
        {
            return(FarmPropertyBag.Load(name));
        }