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:
- 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: