ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context); foreach(UserProfile userProfile in
profileManager)
{string userName =userProfile[PropertyConstants.AccountName].Value.ToString();
Logger.LogDebug("Creating
personal site for user : " + userName);
Logger.LogDebug("Created
personal site for user : " + userName);
SPSite personalSite = userProfile.PersonalSite;
using(SPWeb web = personalSite.OpenWeb()){
if(!Utility.ListExists(ConfigurationInfo.PhotoLibraryDisplayName,web))
{ SPListTemplateType templateType = SPListTemplateType.PictureLibrary;
Guid listId = web.Lists.Add(ConfigurationInfo.PhotoLibraryDisplayName,null, templateType);
SPList PhotoLibrary = web.Lists[listId];
PhotoLibrary.Description = "This is a picture library to show photos";
PhotoLibrary.OnQuickLaunch= true;
PhotoLibrary.Update();
web.AllowUnsafeUpdates = true;
web.Dispose();
}
}
}
catch(Exception ex)
Logger.LogDebug("error while creating MySite :" + ex.Message);
}
}
No comments:
Post a Comment