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 中的[::-1]
    python 闭包
    elastic
    文件上传进度条修改
    python decorator的理解
    同方爬虫--面试题
    js typeof
    浅谈软件项目实施
    数独·唯一性技巧(Uniqueness)-1
    数独二
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/2345279.html
Copyright © 2011-2022 走看看