PHP-SharePoint-Lists-API icon indicating copy to clipboard operation
PHP-SharePoint-Lists-API copied to clipboard

how to add a "person" in a "person field"?

Open reiniertc opened this issue 5 years ago • 1 comments

How do I correctly add a "person" in a "person" field of a sharepoint list? I've tried using the user-id, the full name and the emailadress of the user .

When I enter the person in the list via Sharepoint and than retrieve that list, I see something like:"{number};#{full user name} the number is always the same per user.

reiniertc avatar Jul 21 '20 10:07 reiniertc

I've been able to add 'person' fields as well as 'lookup' fields via the lookup (or magicLookup) function. If you know the number (I suppose sort of ID?) and name of a person, you can get the correct value to save via $sp->lookup'{number}', '{full user name}'). Full working example: $sp->write('{List Name}', array('Title'=>'Example item','PersonLookup field'=>$sp->lookup('{number}', '{full user name}'), 'OtherColumnLookupField'=>$sp->magicLookup('{Value}', '{List in which you lookup}'));

JLauwyck avatar Feb 15 '22 14:02 JLauwyck