【问题标题】:PowerApps - Unable to set SharePoint Person/People field to Current UserPowerApps - 无法将 SharePoint 人员/人员字段设置为当前用户
【发布时间】:2019-03-29 03:12:27
【问题描述】:

我可以在 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)

更新person字段DataCard的属性:

//DataCardValue6 is my person dropdown control
If(varAlwaysTrueForTest, myself, DataCardValue6.Selected)

结果 - 应填充当前用户

【问题讨论】:

  • 如果您对我的帖子有任何疑问,请发表评论。如果您在没有上下文的情况下投票,我无法改进它。

标签: office365 sharepoint-online powerapps peoplepicker


【解决方案1】:

我在下面的帖子中找到了答案。根本问题是需要在下拉控件上设置的属性。它应该是 DefaultSelectedItems。 此外,传递给控件的记录只需要 DisplayNameClaims 属性。

https://powerusers.microsoft.com/t5/General-Discussion/How-to-set-a-defaul-value-for-a-person-fields-in-a-SharePoint/m-p/188290#M61575

屏幕的 OnVisible 事件

UpdateContext({ myself: 
 { 
    Claims:"i:0#.f|membership|" & Lower(User().Email), 
    DisplayName:User().FullName 
 }
})

DefaultSelectedItems

If(varAlwaysTrueForTest, myself, Parent.Default)

【讨论】:

    猜你喜欢
    • 2015-11-21
    • 1970-01-01
    • 2019-12-09
    • 2019-12-24
    • 2011-05-31
    • 2020-11-13
    • 1970-01-01
    • 1970-01-01
    • 2018-01-25
    相关资源
    最近更新 更多