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. 

  • 相关阅读:
    Python(93)_网络编程基础
    Web前端(13)_路径
    Web前端(12)_注释
    Web前端(11)_base标签
    Python(91)_python复习
    Web前端(10)_css文本样式
    Web前端(9)_div+span等标签
    虚拟化(6)_CPU虚拟化
    虚拟化(5)_打开tcp监听
    虚拟化(4)_离线克隆与在线克隆
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/2345279.html
Copyright © 2011-2022 走看看