Hi , I have created one app that will patch Office 365 users to share point lists the thing is it patches the currency user manager and how to patch each emp in the list manager
ForAll(
Filter(
Office365Users.SearchUser(),
AccountEnabled = true
),
With(
{
ExistingItem: LookUp(
'Employee information list',
Email = Mail
)
},
If(
IsBlank(ExistingItem),
// If the user does not exist, create a new item
Patch(
'Employee information list',
Defaults('Employee information list'),
{
Display_name: DisplayName,
Phone_number: mobilePhone,
First_name: GivenName,
Department_Name: Department,
'designation ':JobTitle,
Email: Mail,
'Line Manager1':{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Office365Users.ManagerV2(Office365Users.MyProfileV2().id).displayName,
Department: "",
DisplayName: Office365Users.ManagerV2(Office365Users.MyProfileV2().id).displayName,
Email: Office365Users.ManagerV2(Office365Users.MyProfileV2().id).mail,
JobTitle: "",
Picture: ""
}
}
),
// If the user exists, update the existing item
Patch(
'Employee information list',
ExistingItem,
{
Display_name: DisplayName,
Phone_number: mobilePhone,
First_name: GivenName,
Department_Name: Department,
Email:Mail,
'designation ':JobTitle,
'Line Manager1':{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Office365Users.ManagerV2(Office365Users.MyProfileV2().id).displayName,
Department: "",
DisplayName: Office365Users.ManagerV2(Office365Users.MyProfileV2().id).displayName,
Email: Office365Users.ManagerV2(Office365Users.MyProfileV2().id).mail,
JobTitle: "",
Picture: ""
}
}
)
)
)
)