本文整理汇总了C#中UserProfile.GetDirectReports方法的典型用法代码示例。如果您正苦于以下问题:C# UserProfile.GetDirectReports方法的具体用法?C# UserProfile.GetDirectReports怎么用?C# UserProfile.GetDirectReports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserProfile
的用法示例。
在下文中一共展示了UserProfile.GetDirectReports方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstanceEmployee
public static Employee InstanceEmployee(UserProfile profile, SPSite site)
{
Employee employee = new Employee();
employee.UserAccount = profile[PropertyConstants.AccountName].Value + "";
employee.DisplayName = profile[PropertyConstants.FirstName].Value + " " + profile[PropertyConstants.LastName].Value;
employee.PreferredName=profile[PropertyConstants.PreferredName].Value + "";
string strDepartment = profile[PropertyConstants.Department].Value + "";
if (strDepartment.Contains(';'))
{
employee.Department = strDepartment.Substring(0, strDepartment.IndexOf(';') );
employee.AllDepartment = strDepartment;
}
else
{
employee.Department = strDepartment;
employee.AllDepartment = strDepartment;
}
employee.Manager = profile[PropertyConstants.Manager].Value + "";
//add by wujun 20100709
//begin
employee.Phone = profile[PropertyConstants.WorkPhone].Value + "";
employee.Mobile = profile[PropertyConstants.CellPhone].Value + "";
employee.WorkEmail = profile[PropertyConstants.WorkEmail].Value + "";
//http://wsc2337:91/personal/wsq/Shared%20Pictures/配置文件图片/懂得.gif
employee.PhotoUrl = profile[PropertyConstants.PictureUrl].Value + "";
//end
//add by wujun 20100714
employee.Title = profile[PropertyConstants.Title].Value + "";
employee.More = profile[PropertyConstants.Office].Value + "";
employee.Fax = profile[PropertyConstants.Fax].Value + "";
employee.PopulateName = "";
if (string.IsNullOrEmpty(employee.PhotoUrl))
{
string fileName = profile[PropertyConstants.UserName].Value + "";
employee.PhotoUrl = ConfigurationManager.AppSettings["userPhotoLocation"] + fileName.Replace('.', ' ') + ConfigurationManager.AppSettings["userPhotoType"];
if (!site.RootWeb.GetFile(employee.PhotoUrl).Exists)
{
employee.PhotoUrl = ConfigurationManager.AppSettings["userPhotoLocation"] + "default.jpg";
}
}
employee.ApproveRight = !string.IsNullOrEmpty((profile["ApproveRight"].Value + "").Trim());
employee.EmployeeID = (profile["EmployeeId"].Value + "").Trim();
//added by wsq 20101118
List<string> listreports = new List<string>();
foreach(UserProfile report in profile.GetDirectReports())
{
listreports.Add(report["UserName"].Value + "");
}
employee.DirectReports = listreports.ToArray();
return employee;
}