SharePoint MySites URL 冲突
用户使用他们的电子邮件地址登录我们创建的 SharePoint 网站,这将成为他们的用户名。然而,这给 MySites 带来了一个问题。
当用户创建 MySite 时,URL 会删除用户名中 @ 符号之后的任何内容,因此如果用户的电子邮件地址为 [电子邮件受保护] 其 MySite 的 URL 变为:
http://host/personal/user1/
但是,如果他们是具有相同电子邮件前缀但具有不同域的另一个用户,即 [电子邮件受保护]。该用户的 MySite URL 也需要是
http://host/personal/user1/
当用户注册到我们使用以下代码创建其个人资料和 MySite 的网站时:
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;
我可以在此处执行某些操作来控制所使用的 URL?
-- 编辑
上述行为是 MOSS 的默认行为。也就是说,我没有手动获取用户的电子邮件地址,这是 MOSS 自动执行的操作。如果我可以说 URL 应该是这样的话,我会更喜欢它:
http://host/personal/user1-at-test-dot-com
我已经尝试转义电子邮件地址并将其分配给个人空间值,如下所示:
string clean = email.Replace("@","-at-");
profile["PersonalSpace"].Value= clean;
....
但这没有帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一种不常见的做法,根据电子邮件而不是用户名创建用户是否有任何具体原因?无论如何,这里有一些想法。
编辑
根据您的编辑,您可以在 moss 本身中配置冲突解决方案,这就是为什么我说这是一种创建 url 的奇怪方式,
在您的 SSP 中,转到 MySite 设置,查看站点命名格式 组
您的选项:
用户名(不解决冲突)
示例: http://portal_site/location/username/
用户名(通过使用domain_username解决冲突)
示例: .../username/ 或 .../domain_username/
域名和用户名(不会有冲突)
示例: http://portal_site/location/domain_username/
This is an uncommon way of doing it, is there any specific reason the users are created based on the email not the username? Anyway, here's a few ideas.
edit
Based on your edit, you can configure the conflict resolution in moss itself, that's why I said it was a weird way of creating the urls,
In your SSP, go to MySite Settings, look at the Site Naming Format group
Your options:
User name (do not resolve conflicts)
Example: http://portal_site/location/username/
User name (resolve conflicts by using domain_username)
Example: .../username/ or .../domain_username/
Domain and user name (will not have conflicts)
Example: http://portal_site/location/domain_username/