AssignedTo是一个用户与组字段,但其只能单选,其允许组及用户,其取值可以从以下取

          SPFieldUser fieldValue = taskItem.Fields.GetField("AssignedTo") as SPFieldUser;
            SPFieldUserValue user = (SPFieldUserValue)fieldValue.GetFieldValue(taskItem["AssignedTo"].ToString());

            SPUser userObject = user.User;
            SPGroup groupObject = null;
            if (userObject == null)
            {
                groupObject = web.SiteGroups[user.LookupValue];
            }
            if (userObject != null)
            {
                Response.Write("Approval is User<br/>");
                Response.Write("User Name:+"+userObject.LoginName+"<br/>");
            }
            else if(groupObject!=null)
            {
                Response.Write("Approval is Group<br/>");
                Response.Write("Group Name:" +groupObject.Name + "<br/>");
            }

 

posted on 2012-08-16 21:38  gzh4455  阅读(448)  评论(0编辑  收藏  举报