Second Life of a Hungarian SharePoint Geek

April 16, 2010


  1. […] Helper methods in the AD2SP_Click method (UploadPhoto, SetPictureUrl, GetMySiteHostUrl etc.) are similar to the ones used in my former solutions here and here. […]

    Pingback by Synchronizing user image between Active Directory and SharePoint profile « Second Life of a Hungarian SharePoint Geek — August 10, 2010 @ 01:30

  2. Awesome, thnx, had this working in MOSS, so this is great for our migration plans!

    Comment by Colin — September 29, 2010 @ 01:48

  3. I tried to do something similar to this (getting a UserProfileApplication from Farm > Services >Applications); which works fine in a single farm environment.
    If your UPA is actually in remote farm however, it doesn’t work.

    I tried doing this same, but via the proxy classes instead (Farm > ServiceProxies > ApplicationProxies). The UserProfileApplicationProxy class does have an internal GetMySitePortalUrl method too – but invoking it in this class (when the application itslef is in a remote farm) fails 😦

    Have you experiemented with this at all? Do you have any ideas on how you might get the Url in a multi-farm environment?

    I just can’t seem to get it to work 😦

    Comment by Pbj — October 1, 2010 @ 14:38

  4. Excellent. Just exactly the information I was looking for. Thanks for posting.

    Comment by Mark Kordelski — April 26, 2011 @ 17:21

  5. Hey, why not following?

    UserProfileManager upm = new UserProfileManager(ctxt);
    string mySiteHostUrl = upm.MySiteHostUrl;

    With the right context, don’t you get the URL you are looking for?

    Comment by Ariel Kirsman — July 7, 2011 @ 20:56

    • Hi Ariel,

      Thanks for sharing that, it really much simpler than the method I found. And it is public info long ago as I found now, for example here:
      Personal Site URL.

      Comment by Peter Holpar — July 8, 2011 @ 07:20

  6. Wow! Excellent post. I had been trying to do this myself for a few weeks and got no where. Thanks!

    Comment by sdfsda — January 4, 2012 @ 15:42

    • See Ariel’s suggestion above. It’s better than my “hacky” solution.

      Comment by Peter Holpar — January 4, 2012 @ 20:42

      • Yes, but as you know by now, I was actually interested in the Search Center URL, which isn’t so easily exposed.

        Comment by sdfsda — January 4, 2012 @ 21:27

      • Actually, I’ve used the UserProfileManager.MySiteHostUrl property in another instance, however there isn’t such a property for the Search url. I’m glad you did this anyway, as I had failed in my own attempts.

        Comment by sdfsda — January 4, 2012 @ 21:36

  7. Would you know how to do this same thing but to get the appropriate Search Scope page (i.e., “results.aspx”, or “peopleresults.aspx”), depending on what is setup in the MySites.


    Comment by sdfsda — January 4, 2012 @ 18:30

    • I think in this case you should call the GetSearchCenterUrl method instead of the GetMySitePortalUrl method.

      Comment by Peter Holpar — January 4, 2012 @ 21:25

      • Thanks, I’ve done that, however this only returns the non-scoped result, i.e., the root URL, but not the actual “landing” page. For instance, if the People search results Scope is changed from People to All Sites, I want my code to be able to detect that. Even better, how to tell programmatically if a custom Search page has been selected. Right now, I’ve got as a backup a Resource file entry, but it’s not very tight.

        Comment by sdfsda — January 4, 2012 @ 21:29

  8. More awesomeness. Thanks!

    Comment by Andrew — April 20, 2012 @ 22:14

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: