Wednesday, August 3, 2011

Getting A User's Information Is Based On An E-mail Is Stored As A Text


SPList UserInfoList = site.SiteUserInfoList;
                                        string useremail = oOpenItem["UserEmailAddress"].ToString();
                                   
                                      
                                   
                                        SPQuery query = new SPQuery();
                                        query.ViewFields = "";
                                        query.Query = "" + assigneeusername + "";

                                    
                                        SPListItemCollection UserItems = UserInfoList.GetItems(query);
                                       
                                        if (UserItems != null)
                                        {
                                            SPListItem UserItem = UserItems[0];
                                            strDept = UserItem["Department"] == null ? "No Department" : UserItem["Department"].ToString();
                                        }
                                        else
                                        {
                                            myLog.WriteEntry(assigneeusername + "Not Found");

                                        }
                                    }
                                    else
                                        strDept = string.Empty;

SPONSORS:

No comments:

Post a Comment