I have designed a scheduled flow that creates an Excel file which team members to fill their work mode (WFO/WFH). For team members details like Employee Name, Employee Email these details I am extracting using the Microsoft Teams action that's available in Power Automate i.e. 'List members action', so the flow structure looks like this:
This flow creates a file like:
As you can see the structure in above picture.
So this works but I was thinking whether it is possible to the Work Location that is introduced by Microsoft in teams app/teams desktop where users set their work location : Remote/Office
So currently the flow that I have designed runs (scheduled flow) every Monday morning around 9:30 am, but I was thinking if are able to extract the Work location then every weekday (Monday to Friday) morning around 10/11 am I want to run the flow and check the Work location for every user present in the Teams group and accordingly use that value and fill that for the respective day, so is it possible to do that?
//The expression that adds the details that I mentioned earlier like Employee Name, Email
{
"SNo": "@{variables('varCounter')}",
"Employee Name": "@{items('Add_Team_Member_to_Excel')?['displayName']}",
"Employee Email": @{items('Add_Team_Member_to_Excel')?['email']},
"@{split(outputs('Header'),',')[3]}": "@{if(contains(join(body('Select'),', '),
concat(' ',split(outputs('Header'),',')[3])),'Holiday',if(contains(variables('WFOMembers'),
items('Add_Team_Member_to_Excel')?['email']),'WFO',''))}",
"@{split(outputs('Header'),',')[4]}": "@{if(contains(join(body('Select'),', '),
concat(' ',split(outputs('Header'),',')[4])),'Holiday',if(contains(variables('WFOMembers'),
items('Add_Team_Member_to_Excel')?['email']),'WFO',''))}",
"@{split(outputs('Header'),',')[5]}": "@{if(contains(join(body('Select'),', '),
concat(' ',split(outputs('Header'),',')[5])),'Holiday',if(contains(variables('WFOMembers'),
items('Add_Team_Member_to_Excel')?['email']),'WFO',''))}",
"@{split(outputs('Header'),',')[6]}": "@{if(contains(join(body('Select'),', '),
concat(' ',split(outputs('Header'),',')[6])),'Holiday',if(contains(variables('WFOMembers'),
items('Add_Team_Member_to_Excel')?['email']),'WFO',''))}",
"@{split(outputs('Header'),',')[7]}": "@{if(contains(join(body('Select'),', '),
concat(' ',split(outputs('Header'),',')[7])),'Holiday',
if(contains(variables('WFOMembers'),items('Add_Team_Member_to_Excel')?['email']),'WFO',''))}"
}
//Also I have a Holiday List which mentions the Holidays for the current calendar year so in the above
expression a check is been done if the date is match with any of the dates in the Holiday list if yes
then just append 'Holiday' for that particular date column else check if that particular user email
is part of WFOMembers array list if yes: then append WFO else leave it blank
//For weekdays I have mentioned a compose action at the start of the flow (named Headers)
SNo, Employee Name, Employee Email, @{string(formatDateTime(utcNow(),'d/M/yyyy'))},
@{string(formatDateTime(addDays(utcNow(),1),'d/M/yyyy'))},
@{string(formatDateTime(addDays(utcNow(),2),'d/M/yyyy'))},
@{string(formatDateTime(addDays(utcNow(),3),'d/M/yyyy'))},
@{string(formatDateTime(addDays(utcNow(),4),'d/M/yyyy'))}
If you need any more information do let me know.
Regards,
Sidhant.

Report
All responses (
Answers (