如何将此显示名称转换为SPUser类型: 我的输入是:FirstName,SecondName(ext)(域\用户)
答案 0 :(得分:0)
string input = @":FirstName, SecondName (ext)(domain\user)";
var loginName = Regex.Match(input, @"\((?<login>[^\(\\]+\\[^\(\\]+)\)$", RegexOptions.ExplicitCapture).Groups["login"].Value;
var user = web.EnsureUser(loginName);
var loginName = input.Split('(', ')')[3];
var user = web.EnsureUser(loginName);