SharePoint MySites URL冲突(SharePoint MySites URL Conflict)

编程入门 行业动态 更新时间:2024-10-27 18:27:11
SharePoint MySites URL冲突(SharePoint MySites URL Conflict)

用户使用他们的电子邮件地址登录我们创建的SharePoint网站,这将成为他们的用户名。 但是,这会给MySites带来问题。

当用户创建一个MySite时,它会删除用户名中@符号后面的任何内容,因此如果用户的电子邮件地址是user1@test.com,则其MySite的URL将变为:

http://host/personal/user1/

但是,如果他们是具有相同电子邮件前缀但具有不同域的另一个用户,即user1@anotherdomain.com,则会导致问题。 此用户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 user1@test.com 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. user1@anotherdomain.com. 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.

最满意答案

这是一种不常见的方式,有没有特定的原因根据电子邮件而不是用户名创建用户? 无论如何,这里有一些想法。

使用常规命名冲突解决方案,在url user_domain中包含域名, 如果发生冲突,则创建唯一的Id user_1,user_2,并检查下划线后面的数字以生成下一个。

编辑

根据您的编辑,您可以在moss中配置冲突解决方案,这就是为什么我说这是创建网址的一种奇怪方式,

在您的SSP中,转到“我的网站设置”,查看“ 网站命名格式”

你的选择:

用户名(不解决冲突)示例: 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.

Use normal naming conflict solutions, include the domain in the url user_domain, create an unique Id user_1, user_2 if a conflict happens and check what number is after the underscore to generate the next one.

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/

更多推荐

本文发布于:2023-08-03 13:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390821.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:冲突   MySites   SharePoint   Conflict   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!