Create Personal Site In Office 365 Enviroment

Introduction to My Site in SharePoint 2013/Office 365

My Site is a personal site for individual users in an organization.

The default link on the top of every page displays tabs for:
  1. Newsfeed
  2. OneDrive
  3. Sites
The default links on the left navigation bar that are visible to the owner of the My Site are as follows:
  1. Newsfeed
  2. About me
  3. Blog
  4. Apps
  5. Tasks
  6. Recent
In this article, I have give the code to create a personal site in Office 365 using object model.
  1. public void CreatePersonalSiteUsingCSOM(string tenantAdminUrl, string userName, string password, string[] emailIDs)  
  2. {  
  3.       using (ClientContext _context = new ClientContext(tenantAdminUrl))  
  4.       {  
  5.             try  
  6.             {  
  7.                   SharePointOnlineCredentials _creds = new SharePointOnlineCredentials(userName, Utilities.StringToSecure(password));  
  8.                   _context.Credentials = _creds;  
  9.                   _context.ExecuteQuery();  
  10.                   ProfileLoader _profileLoader = ProfileLoader.GetProfileLoader(_context);  
  11.                   _profileLoader.CreatePersonalSiteEnqueueBulk(emailIDs);  
  12.                   _profileLoader.Context.ExecuteQuery();  
  13.             }  
  14.             catch(Exception _ex)  
  15.             {  
  16.                   throw;  
  17.             }  
  18.       }  
  19. }