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();
}
);
Do you know someone who can help? Share a link to this thread on twitter, or facebook.