I'm trying to add a user, programmtically, to a field of Type="User" in a SharepointList. Since I do not know the user's unique ID within the site in advance, I'm using the ResolvePrincipals function to add the user to the SPUserCollection as follows:
Dim managerDN() As String = {"[email protected]"}
Dim principalInfo() As PrincipalInfo = people.ResolvePrincipals(managerDN, SPPrincipalType.User, True)
Console.WriteLine(principalInfo(0).UserInfoID)
Problem is when I look at the UserInfoID, which is what I'm looking for, I get back -1. I assumed that the ResolvePrincipals function would add the user to the site user collection automatically (According to MSDN documentation) and create a unique, positive UserInfoID in the process. I'm not sure if I have the right idea or not