我可以在 PowerApp 中为当前用户设置一个人员字段。我已按照下面的教程进行操作,但下拉控件未设置为当前用户。这种方法似乎是如何做到这一点的普遍共识。我一定是错过了一步。
http://www.codeovereasy.com/2017/07/powerapps-set-sharepoint-person-field-to-current-user/
我的屏幕的 OnVisible 属性:
//Here I am setting the person field record to a variable 'myself' with current user values
Collect(Collection1, {Pressed: Button1.Pressed});
UpdateContext({
myself: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & Lower(User().Email),
Department:"",
DisplayName:User().FullName,
Email:User().Email,
JobTitle:".",
Picture:"."
},
manager: Office365Users.ManagerV2(Office365Users.MyProfile().Id).mail,
varAlwaysTrueForTest: true})
人物字段下拉控件的默认属性:
//This should show the current user in the dropdown control after the screen becomes visible
If(varAlwaysTrueForTest, myself, Parent.Default)
更新人员字段 DataCard 的属性:
//DataCardValue6 is my person dropdown control
If(varAlwaysTrueForTest, myself, DataCardValue6.Selected)
结果 - 应填充当前用户