I have a string "System Account", how can I convert the string into SPUser?
I've tried SPContext.Current.Web.EnsureUser("System Account") and also web.AllUser["System Account"] but hit error.
Please help, thank you in advanced.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
You can retrieve the system account by SPSite property
Basicaly EnsureUser method uses logon name (Domain\User_Alias) of the user.
i guess you are looking for some api to resolve inputs. try this utility method:
it will return a SPPrincipal object, witch contains a "LoginName" property. then you can use SPWeb.EnsureUser(loginName) to get a SPUser object.
more infomation about this method: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.resolveprincipal.aspx