SharePoint MySites URL 冲突

发布于 2024-08-14 03:43:17 字数 1759 浏览 6 评论 0原文

用户使用他们的电子邮件地址登录我们创建的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽袖吟 2024-08-21 03:43:17

这是一种不常见的做法,根据电子邮件而不是用户名创建用户是否有任何具体原因?无论如何,这里有一些想法。

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

编辑

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

在您的 SSP 中,转到 MySite 设置,查看站点命名格式 组

您的选项:

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:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文