A user logins into the SharePoint site we have created using their email address and this becomes their username. However this creates a problem for MySites.
When the user creates a MySite the URL it cuts of anything after the @ symbol in the username, so if the users email address is [email protected] the URL to their MySite becomes:
http://host/personal/user1/
However this causes a problem if their is another user with the same email prefix but with a different domain i.e. [email protected]. This users MySite URL also needs to be
http://host/personal/user1/
When the user signs up to the site we create their profile and MySite using this code:
if (!profileManager.UserExists(username))
{
UserProfile profile = profileManager.CreateUserProfile(username);
profile["PreferredName"].Value = fullname!=null?fullname:username;
profile["WorkEmail"].Value = email != null ? email : "";
profile["PersonalSpace"].Value = email;
profile.Commit();
#region create User My Site
using (SPSite site = profile.PersonalSite)
{
if (site == null)
{
try
{
profile.CreatePersonalSite();
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(string.Format("CreateMySite - {0}", ex.Message));
throw ex;
}
}
}
#endregion
}
HttpContext.Current = httpCxt;
Is there something I can do here to control the URL used?
-- edit
The above behaviour is default for MOSS. I.e. I am not manually taking of the users email address, this is something the MOSS is doing automatically. I would prefer it if I could say the URL should be:
http://host/personal/user1-at-test-dot-com
I have tried escaping the email address and assigning it to the personal space value like so:
string clean = email.Replace("@","-at-");
profile["PersonalSpace"].Value= clean;
....
but this hasn't helped.