I am trying to run a piece code to figure out if a user has a mysite or not. Following is the code:
UserProfileManager profManager = new UserProfileManager();
UserProfile profile = profManager.GetUserProfile(Constants.MembershipProvider + ":" + username);
if (profile == null || profile.PersonalSite == null) {
valueToReturn = false;
}
So the code works just fine when accessed under the context of a logged in user, but gets an access denied when trying to run annonymously. I tried wrapping the code with SPSecruity.RunWithElevatedPrevilege but to no avail.
Any idea how I can access the data for annonymous users?
Thanks.