I am trying to get Public URL of all my sites. i have ran this code for every loginname and its working fine except for one user. for this user i am getting null in up.PersonalSite. i have checked it manually and mysite for that user exists. any ideas why up.personalsite is returning null. any suggestions?
SPServiceContext context = SPServiceContext.GetContext(Site);
UP.UserProfileManager upm = new UP.UserProfileManager(context);
UP.UserProfile up = upm.GetUserProfile(LoginName);
if (up.PersonalSite == null)
return "#";
else
return up.PublicUrl.OriginalString;