SPUser and LookUp Field update values

public static SPUser GetSPUser(SPWeb web,string userName)
        {
            SPUser user=web.EnsureUser(userName);

            return user;
        }

public static int ParseLookupId(string fieldValue,SPList list,string fieldName)
        {
            int lookUpID = 0;
            try
            {
                foreach (SPListItem item in list.Items)
                {
                    if (item[fieldName].ToString()==fieldValue)
                    {
                        lookUpID = int.Parse(item["ID"].ToString());
                    }
                }
            }
            catch (Exception)
            {
               
                throw;
            }

            return lookUpID;
        }

posted @ 2012-05-03 14:42  大刀客  阅读(164)  评论(0编辑  收藏  举报