I wanted to know the equivalent of SPWeb.EnsureUser() in web services and this is what I found:
The people.asmx web service contains a method that let us do exactly the same than what EnsureUser() does. The method is: ResolvePrincipals(), it resolves an e-mail address or other form of user identification into a PrincipalInfo object.
One of the parameter let us indicate whether to add the user to the web if it does not exist already.
This is the syntaxis:
Parameters
- principalKeys. Logon name of the principal.
- principalType. SPPrincipalType object that specifies user scope and other information.
- addToUserInfoList. Indicates whether to add the principal to a SPUserCollection that is associated with the Web site.
Return Value: A list of PrincipalInfo objects that is indexed and accessed by the logon name in the AccountName field.
To use it is very simple:
Very useful!


I’m Karla Ponce, a SharePoint consultant based in Houston. I have been involved in the full life cycle of the software development process and have a great passion for technology and how to apply it to satisfy and improve business operations. One of my passions is SharePoint(of course!) so this blog is created as a way to share my experiences with sharepoint. To know more about me 




Comments
Leave a comment Trackback