SPFieldUserValueCollection SPFieldUserValue
来源:互联网 发布:webpackconfig.js详解 编辑:程序博客网 时间:2024/06/06 05:39
SPFieldUserValueCollection
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
SPFieldUserValue Class
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Inheritance Hierarchy SPFieldUserValue 继承自Microsoft.SharePoint.SPFieldLookupValue
所以有
LookupID:Gets or sets the ID of the lookup field;
LookupValue:Gets the value of the lookup field as a string.
本身有
User:Gets the user that is associated with the field value;
SipAddress:Gets the Session Initiation Protocol (SIP) address of the user.
下面是一段代码:收集用户或用户组栏里面所有的用户和用户组。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
SPFieldUserValue Class
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Inheritance Hierarchy
所以有
LookupID:Gets or sets the ID of the lookup field;
LookupValue:Gets the value of the lookup field as a string.
本身有
User:Gets the user that is associated with the field value;
SipAddress:Gets the Session Initiation Protocol (SIP) address of the user.
下面是一段代码:收集用户或用户组栏里面所有的用户和用户组。
List<SPUser> Users = new List<SPUser>();
List<SPGroup> Groups = new List<SPGroup>();
using (SPSite Site = new SPSite("http://windbell"))
{
SPWeb Web = Site.RootWeb;
SPList List = Web.Lists["测试列表"];
SPItem Item = List.Items[0];
SPFieldUserValueCollection Values = (SPFieldUserValueCollection)Item["用户和用户组"];
foreach (SPFieldUserValue Value in Values)
{
if (User != null)
{
SPUser User = Value.User;
Users.Add(User);
}
else
{
SPGroup Group = Web.Groups.GetByID(Value.LookupId);
Groups.Add(Group);
Users.AddRange(Group.Users);
}
}
}
List<SPGroup> Groups = new List<SPGroup>();
using (SPSite Site = new SPSite("http://windbell"))
{
SPWeb Web = Site.RootWeb;
SPList List = Web.Lists["测试列表"];
SPItem Item = List.Items[0];
SPFieldUserValueCollection Values = (SPFieldUserValueCollection)Item["用户和用户组"];
foreach (SPFieldUserValue Value in Values)
{
if (User != null)
{
SPUser User = Value.User;
Users.Add(User);
}
else
{
SPGroup Group = Web.Groups.GetByID(Value.LookupId);
Groups.Add(Group);
Users.AddRange(Group.Users);
}
}
}
- SPFieldUserValueCollection SPFieldUserValue
- SharePoint的SPFieldUserValueCollection.Add方法
- sharepoint 2010 从PeopleEditor控件中取出多用户,并返回SPFieldUserValueCollection
- sharepoint2010 当人员控件显示为中文姓名时 如何获得此人的登录名--SPFieldUserValue用法
- SharePoint 2013 抽取SPFieldUserValueCollection中包含的AD用户(含嵌套的AD组,AD组多层嵌套,SP组嵌套AD组)
- 领导沉稳性格如何磨砺
- CodeDom:语言的界限在这里消失
- 优秀是一种习惯:几个英语学习习惯的介绍和实施
- HTTP协议基础
- [11] 拦截器(langsin.com)
- SPFieldUserValueCollection SPFieldUserValue
- Javascript中最常用的55个经典技巧
- Hibernate中DetachedCriteria的使用
- 敲响警钟
- 2008/10/07
- 优化平台页面
- ANSI C中获取结构体成员偏移量量的办法
- 需要记住的javascript技巧
- Web Services Enhancement3.0