本文整理汇总了C#中SPWeb.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# SPWeb.GetProperty方法的具体用法?C# SPWeb.GetProperty怎么用?C# SPWeb.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPWeb
的用法示例。
在下文中一共展示了SPWeb.GetProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindServiceLocatorAccessorTypeNameFromMostSpecificPropertyBag
/// <summary>
/// Inspects the property bags of all SPPersistedObjects in the
/// context, from SPWeb to SPSite to SPWebApplication to SPFarm.
/// </summary>
/// <param name="web">The context's SPWeb. Keep null if none available.</param>
/// <param name="site">The context's SPSite. Keep null if none available.</param>
/// <param name="webApplication">The context's SPWebApplication. Keep null if none available.</param>
/// <param name="farm">The context's SPFarm. Keep null if none available.</param>
/// <param name="locationWhereDiscriminatorWasFound">An out parameter string that returns the identity of the SPPersistedObject where the discriminator setting was found</param>
/// <returns>The ServiceLocatorAssemblyName discriminator settings, if found in one of the context objects' property bags</returns>
private static string FindServiceLocatorAccessorTypeNameFromMostSpecificPropertyBag(SPWeb web, SPSite site, SPWebApplication webApplication, SPFarm farm, out string locationWhereDiscriminatorWasFound)
{
if (web != null && web.AllProperties.ContainsKey(KeyServiceLocatorAssemblyName))
{
locationWhereDiscriminatorWasFound = "SPWeb @ " + web.Url;
return web.GetProperty(KeyServiceLocatorAssemblyName).ToString();
}
else if (site != null && site.RootWeb.AllProperties.ContainsKey(KeyServiceLocatorAssemblyName))
{
locationWhereDiscriminatorWasFound = "SPSite.RootWeb @ " + site.RootWeb.Url;
return site.RootWeb.GetProperty(KeyServiceLocatorAssemblyName).ToString();
}
else if (webApplication != null && webApplication.Properties.ContainsKey(KeyServiceLocatorAssemblyName))
{
locationWhereDiscriminatorWasFound = "SPWebApplication @ " + webApplication.DisplayName;
return (string)webApplication.Properties[KeyServiceLocatorAssemblyName];
}
else if (farm != null && farm.Properties.ContainsKey(KeyServiceLocatorAssemblyName))
{
locationWhereDiscriminatorWasFound = "SPFarm @ " + farm.DisplayName;
return (string)farm.Properties[KeyServiceLocatorAssemblyName];
}
else
{
locationWhereDiscriminatorWasFound = "Not found!!!";
return string.Empty;
}
}