Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dennythecoder/8d87b80ecf99da82b217b133d5233a58 to your computer and use it in GitHub Desktop.
Save dennythecoder/8d87b80ecf99da82b217b133d5233a58 to your computer and use it in GitHub Desktop.
Power Apps - Populate Field with Current User

Populate Field with Current User

Requires 'Office365Users' Connector.

What I'm doing here is prepopulating a field on an item form that references a people column in a SharePoint list.

Named formulas

CurrentUser = Office365Users.MyProfileV2();
CurrentUserPhoto = Office365Users.UserPhotoV2(CurrentUser.mail);
CurrentUserObject = {
        '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims: "i:0#.f|membership|" & CurrentUser.mail,
        Department: CurrentUser.department,
        DisplayName: CurrentUser.displayName,
        Email: CurrentUser.mail,
        JobTitle: CurrentUser.jobTitle,
        Picture: CurrentUserPhoto
};

Item Form

For the DataCardValue combobox that selects a person, under DefaultSelectedItems:

If(ItemForm.Mode = FormMode.New, CurrentUserObject, Parent.Default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment