Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

MOSS Object Model - cannot obtain user profile

  Asked By: Gaurang    Date: Nov 26    Category: MOSS    Views: 1022

I am trying to obtain a UserProfile object given a
UserName string. I am sure that the user exists in
MOSS, but I am unable to find him using the
UserProfileManager. The Count property of the
UserProfileManager object returns 1 -- it only
recognizes me!

I am running my code under elevated privileges. In
the web.config, trustLevel is Full. I'm guessing that
there's another security setting I've missed. My code
is below.

SPSecurity.RunWithElevatedPrivileges(
delegate() {
SPSite mySite = new
SPSite(workflowProperties.Site.Url);

ServerContext myServerContext =
ServerContext.GetContext(mySite);

UserProfileManager myUsrProMgr = new
UserProfileManager(myServerContext);

email =
myUsrProMgr.GetUserProfile(UserName)[Microsoft.Office.Server.UserProfiles.Proper\
tyConstants.WorkEmail].Value.ToString();
}
);

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on MOSS Object Model - cannot obtain user profile Or get search suggestion and latest updates.




Tagged: