Using SPClientPeoplePicker and UpdateListItems

Oct 2, 2014 at 10:42 AM

This might be just a SharePoint question, but since this place is crawling wit SharePoint-savvy people I put the question here.

I have a form where I use the SPClientPeoplePicker. I've succeeded in getting the value from the fields in question, but the value is in this format: i:0#.w|\username. It seems that the list won't accept these values. I have successfully added to the list by using the format 1;\username, where the number is the user's ID on the site. Problem is; with this form there is a chance of adding users who are not added to the site.

I have tried to use ensureUser to somehow add the user before the values get submitted to the form. I see that this probably doesn't work, since no user gets added to the default group.

So, the question is: How can I submit a user who doesn't yet exist on the site to a form? What is the syntax that will be accepted by the list?

Thank you for your time!

Eirik Johannessen