I stumbled across this question yesterday. As a matter of fact, there is a Web Service equivalent of web.EnsureUser
, but it is not in the UserGroup Web service. Use the ResolvePrincipals
method of the People web service (_vti_bin/people.asmx) instead.
Here is the Microsoft documentation.
The key is to feed in true
for the value of addToUserInfoList
. The PrincipalInfo
object returned by the service call includes a UserInfoID
, which you can use in other membership-related operations on that site.
Here is an example of using the web service from PowerShell 2.0:
$client = new-webserviceproxy http://mysharepointsite/_vti_bin/people.asmx?wsdl -usedefault
$person = $client.ResolvePrincipals(@('domain\user'), 'User', $true)
# ...