using UserProfileManager - InfoPath Dev
in

InfoPath Dev

using UserProfileManager

Last post 12-16-2010 12:56 AM by gul_ydu. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 12-16-2010 12:56 AM

    using UserProfileManager

    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);

    }

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.