zoukankan      html  css  js  c++  java
  • Get field as SPUser from SPListItem 获取当中的用户

    /// Gets the SPUser from field of Sharepoint list
    /// 
    /// <param name="aItem">The item.
    /// <param name="aIntenalName">The internal field name
    /// 
    private SPUser GetSPUser(SPListItem aItem, string aIntenalName)
    {
    	SPFieldUser field = aItem.Fields.GetFieldByInternalName(aIntenalName) as SPFieldUser;
    
    	if (field != null && aItem[aIntenalName] != null)
    	{
    		SPFieldUserValue fieldValue = field.GetFieldValue(aItem[aIntenalName].ToString()) as SPFieldUserValue;
    
    		if (fieldValue != null)
    		{
    			return fieldValue.User;
    		}
    	}
    
    	return null;
    }
    

     Sharepoint list fields of type "User and Group" in object model as read as string, for example system field "Author", with this code you can getting this type of fields in the correct form. 

  • 相关阅读:
    求助
    debian虚拟机试用
    算是业界新闻吧
    推荐一个图书分享网站
    日志
    写汇编报告小记
    水仙花数
    进程创建
    win32程序运行原理1
    [解题报告]374 Big Mod
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/2345279.html
Copyright © 2011-2022 走看看