Identifying My site on SharePoint 2010 & 2013

What is an easy way to determine if someone has a "My site" on Sharepoint 2010 or 2013?
Lord_DragonAsked:
Who is Participating?
 
Lord_DragonConnect With a Mentor Author Commented:
Is there an OTB or Out of teh Box way of doing this? I need a non code solution. thank you.
0
 
Jayaraja JayaramanSharepoint Architect ConsultantCommented:
create a console app with the following code and this will show you the list of users that has my site
Display Users that have a MySite

//Get the site associated with the users
using (SPSite spSite = new SPSite(@http://localhost))
{
   //Create the server context because you are in a console application
   ServerContext siteContext = ServerContext.GetContext(spSite);
   UserProfileManager pmManager = new UserProfileManager(siteContext);
   foreach (UserProfile spUser in pmManager)
   {
      if (spUser.PersonalSite != null)
      {
         using(SPSite personalSite = spUser.PersonalSite)
         {
            //Use SPSite like a normal site
            Console.WriteLine("personalSite.Url: " + personalSite.Url);
          }
      }
   }
}
0
 
Lord_DragonAuthor Commented:
Need an OTB solution but the help is greatly appreciated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.