Hi
I want to use sharepoint Profile maneger.when i use below code in sharepoint 2007 web part there was no proplem.But now i am using sane code in sharepoint 2010 web part not running.Always gives exeption.Value cannot be null.
Parameter name: strAccountName
plz help me.
using (SPSite spSite = new SPSite(UrlUtil.SiteUrl(this.Page.Request)))
{
SPServiceContext siteContext = SPServiceContext.GetContext(spSite);
UserProfileManager pmManager = new UserProfileManager(siteContext,true);UserProfile topPf;
if (this.Page.Request.QueryString.Get("rootuser")!=null)
{
topPf = pmManager.GetUserProfile(this.Page.Request.QueryString.Get("rootuser"));
}
else
{
topPf = pmManager.GetUserProfile(startProfile);
}
Details topDt = new Details();
topDt.AddProfile(topPf,
this.Page.Request, true);if (topDt.TrimFullName != String.Empty)
{
foreach (UserProfile pf in topPf.GetManagers())
{
Details dt = new Details();
dt.AddProfile(pf,
this.Page.Request, true);if (dt.TrimFullName != String.Empty)
{
employeeList.Add(dt);
}
}
employeeList.Add(topDt);
if (chartDepth > 0)
addChildren(topPf, chartDepth - 1);
}
}
}
catch (Exception ex)
{
AddInList("1", "", "Error", "", ex.Message);
}