0

我在共享点有一个人员选择域。我希望将其 CommaSeparatedAccounts 作为域\用户返回。

但它将 CommaSeparatedAccounts 的值返回为"i:0#.w|domain\user"

找到代码示例。

<%@ Register TagPrefix="spuc" Namespace="Microsoft.SharePoint.WebControls"
             Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<spuc:PeopleEditor ID="PeopleEditor1" runat="server"
                   AllowEmpty="true" MultiSelect="false" SelectionSet="User"  />
4

1 回答 1

0

它将以相同格式为您提供登录名。但是您可以在后面的代码中对此进行解码。

使用以下代码解码用户名:

string userName = null;
SPClaimProviderManager mgr = SPClaimProviderManager.Local;
if (mgr != null)
{
    userName = mgr.DecodeClaim(SPContext.Current.Web.CurrentUser.LoginName).Value;
}
于 2014-05-27T10:41:46.217 回答