当前位置: 首页>>代码示例>>C#>>正文


C# SPWeb.GetProperty方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:andresglx,项目名称:Dynamite,代码行数:38,代码来源:AddOnProvidedServiceLocator.cs


注:本文中的SPWeb.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。