PropertyCollection 类
请注意:此 API 现在已过时。
表示Property对象的集合。
继承层次结构
System.Object
Microsoft.Office.Server.UserProfiles.PropertyCollection
命名空间: Microsoft.Office.Server.UserProfiles
程序集: Microsoft.Office.Server.UserProfiles(位于 Microsoft.Office.Server.UserProfiles.dll 中)
语法
声明
<ObsoleteAttribute("PropertyCollection is replaced by ProfileSubtypePropertyManager.")> _
<SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class PropertyCollection _
Implements IEnumerable
用法
Dim instance As PropertyCollection
[ObsoleteAttribute("PropertyCollection is replaced by ProfileSubtypePropertyManager.")]
[SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class PropertyCollection : IEnumerable
备注
使用PropertyCollection类可以在站点中定义的所有属性的都枚举。
示例
下面的代码示例显示PropertyCollection类的使用。
Public Sub SectionSample()
'Get portal site context from topology.
Dim strUrl As String = "http://SampleName"
Dim tm As New TopologyManager()
Dim ps As PortalSite = tm.PortalSites(New Uri(strUrl))
Dim pc As PortalContext = PortalApplication.GetContext(ps)
'Initialize user profile config manager object.
Dim upcm As New UserProfileConfigManager(pc)
'Sample to create a new section.
Dim pcol As PropertyCollection = upcm.GetPropertiesWithSection()
Dim mysection As [Property] = pcol.Create(True)
mysection.Name = "my section"
mysection.Commit()
pcol.SetDisplayOrderBySectionName(mysection.Name, 0)
pcol.CommitDisplayOrder()
End Sub 'SectionSample
public void SectionSample()
{
//Get portal site context from topology.
string strUrl = "http://SampleName";
TopologyManager tm = new TopologyManager();
PortalSite ps = tm.PortalSites[new Uri(strUrl)];
PortalContext pc = PortalApplication.GetContext(ps);
//Initialize user profile config manager object.
UserProfileConfigManager upcm = new UserProfileConfigManager(pc);
//Sample to create a new section.
PropertyCollection pcol = upcm.GetPropertiesWithSection();
Property mysection = pcol.Create(true);
mysection.Name = "my section";
mysection.Commit();
pcol.SetDisplayOrderBySectionName(mysection.Name, 0);
pcol.CommitDisplayOrder();
}
线程安全性
该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。