sharepoint 创建人类型,用控件读取和设置
来源:互联网 发布:java获取上下文路径 编辑:程序博客网 时间:2024/04/30 09:33
sharepoint学习笔记汇总
http://blog.csdn.net/qq873113580/article/details/20390149
多选类型
string line = "";
using (SPWeb rottWeb = new SPSite(Common.rootUrl).OpenWeb())
{
SPList projectList = rottWeb.GetList(Common.rootUrl + "/Lists/ProjectList/AllItems.aspx");
SPListItem projectitem = projectList.GetItemById(proID);
if (projectitem["ProductLine"] != null)
{
SPFieldLookupValue lookup = new SPFieldLookupValue(projectitem["ProductLine"].ToString());
line = lookup.LookupValue;
}
}
return line;
单用户对象
using (SPWeb spWeb = new SPSite(rootUrl).OpenWeb())
{
author = new SPFieldUserValue(spWeb,item["Author"].ToString()).LookupValue;
人类型控件
<SharePoint:PeopleEditor ID="peProjectTL" runat="server" Width="300px" />
判断是否有填写
function sub()
{
var TLID = "<%=peProjectTL.ClientID %>" + "_downlevelTextBox";
var peProjectTL = document.getElementById(TLID).value;
if (peProjectTL == "") {
alert("请设置项目授权人");
return false;
}
return true;
}
后台给人控件设置值
int proid = Convert.ToInt32(Request.QueryString["proid"]);
using (SPWeb web = new SPSite(RootUrl).OpenWeb())
{
SPList projectSpList = web.GetList(RootUrl + "/Lists/ProjectList/AllItems.aspx");
SPListItem item = projectSpList.GetItemById(proid);
if (item["Authorizer"] != null)
{
SPFieldUserValueCollection spFieldAssignedToCollection = item["Authorizer"] as SPFieldUserValueCollection;
string assignedTologinName = string.Empty;
for (int i = 0; i < spFieldAssignedToCollection.Count; i++)
{
SPFieldUserValue userassignedToValue = spFieldAssignedToCollection[i];
if (i == spFieldAssignedToCollection.Count - 1)
{
assignedTologinName += userassignedToValue.User.LoginName;
}
else
{
assignedTologinName += userassignedToValue.User.LoginName + ",";
}
}
peProjectTL.CommaSeparatedAccounts = assignedTologinName;
}
}
获取后台的值
var assignedToColl = new SPFieldUserValueCollection();
ArrayList list = PeopleEditorAssignedTo.ResolvedEntities;
SPWeb spassignedto = spWeb;
assignedToColl.AddRange(from PickerEntity p in list
select spWeb.EnsureUser(p.Key)
into assignedTo
where true
select new SPFieldUserValue(spWeb, assignedTo.ID, assignedTo.LoginName));
if (assignedToColl.Count != 0)
{
item["AssignedTo"] = assignedToColl;
}
else
{
item["AssignedTo"] = null;
}
- sharepoint 创建人类型,用控件读取和设置
- sharepoint 2010 设置时间控件sharepoint DateTimeControl禁止输入值
- sharepoint各种字段类型如何读取以及赋值...
- 用网格控件读取和编辑数据
- SharePoint: 史上最全c#设置和获取Fields
- 用NSUserDefaults保存和读取程序设置
- 用NSUserDefaults保存和读取程序设置
- 设置和读取主机名
- 设置和读取Cookie
- 设置和读取Cookie
- 属性设置和读取
- 读取和设置cookie
- Android Intent设置类型setType()-调用手机默认分享和读取相册图片
- sharepoint 中获取用的 控件
- iOS项目头文件创建人的设置方法:Created by lxy on 15-3-24.
- SharePoint 2010通过Web Service读取和修改Excel文件
- SharePoint Server 2016 中的数据库类型和说明
- sharepoint 读取权限操作
- 李刚 JavaSE 47集 局部变量
- PAT 1054. The Dominant Color
- 第一周算法概论作业
- HDU部分题目算法归纳(转自http://blog.csdn.net/lizuqingblog/article/details/17392941)
- Python源码-调试-安装
- sharepoint 创建人类型,用控件读取和设置
- 147. Insertion Sort List
- strcpy和memcpy的区别
- 关于线性表的链式存储(链表)的创建,头插法,尾插法,删除链表结点的操作
- 数组中的逆序对数
- ARM GCC Inline Assembler Cookbook
- 【LeetCode】Roman to Integer
- HDU 1312 Red and Black(BFS,DFS)
- Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.