mrackley / StratusForms

Lightweight InfoPath alternative for SharePoint 2007,2010,2013,2016,2019 and Office 365
82 stars 36 forks source link

Inconsistent results from StratusFormsAddUserToPeoplePicker() #83

Open plbowers opened 3 years ago

plbowers commented 3 years ago

When I use StratusFormsAddUserToPeoplePicker(<email address>) to add someone to a peoplepicker and then get it back using StratusFormsGetPeopleFromPeoplePicker(<id>) I get results that look like this:

AutoFillDisplayText: "<display name>"
AutoFillKey: "<email address>"
Description: "<email address>"
DisplayText: "<display name>"
EntityType: "User"
IsResolved: true
Resolved: true
__proto__: Object

When I use the UI to enter a user and select it and then get it back using StratusFormsGetPeopleFromPeoplePicker(<id>) I get results that look like this:

AutoFillDisplayText: "<Display Name>"
AutoFillKey: "i:0#.f|membership|<Email Address>"
AutoFillSubDisplayText: ""
AutoFillTitleText: "<Email Address>\nTenant\n<Email Address>"
Description: "<Email Address>"
DisplayText: "<Display Name>"
DomainText: "<domain prefix>.sharepoint.com"
EntityData:
    Department: ""
    Email: "<Email Address>"
    IsAltSecIdPresent: "False"
    MobilePhone: ""
    ObjectId: "<GUID>"
    Title: ""
__proto__: Object
EntityType: "User"
IsResolved: true
Key: "i:0#.f|membership|<Email Address>"
LocalSearchTerm: "<search term>"
MultipleMatches: []
ProviderDisplayName: "Tenant"
ProviderName: "Tenant"
Resolved: true
__proto__: Object

Note crucially the differing values in AutoFill* fields so those cannot be depended on and, most crucially, the absence of an EntityData object and the Key value when added via StratusFormsAddUserToPeoplePicker().

I am guessing that this works with StratusForms (i.e., a person added programmatically via StratusFormsAddUserToPeoplePicker() presumably gets updated when the form is saved) but it sure would be nice if this function could be used in a more generic sense. I am doing more than just setting and saving the value (I need to pass it elsewhere) and I'm coming up short on usable values in the object.