I was recently asked by a customer using a SharePoint list based Timesheet system if it was possible to populate entries in the Timesheet List automatically based on events in their calendar; for a lot of people, their calendar *is* their timesheet!
This is actually pretty simple using Microsoft PowerAutomate (aka Flow!); a rudimentary example of how this can be achieved is shown in the PowerAutomate screenshot below:
(the code used in the expressions shown is included at the bottom of this article.)
Everyone hates filling in timesheets - this might make life a bit easier!
Note - the above PowerAutomate is very rudimentary; e.g., it's not configured to deal with Event Updates / Cancellations etc. However, a little bit of extra config on the above would make handling Event Updates / Cancellations very possible!
The End Result?
Calendar entries like this:
are automatically converted to SharePoint Timesheet Entries like this! - no manual entry - hallelujah!
Expressions used above:
Convert start time to Ticks
ticks(triggerOutputs()?['body/start'])
Convert end time to Ticks
ticks(triggerOutputs()?['body/end'])
Calculate the duration in hours ((endTicks - startTicks) / 36,000,000,000)
div(sub(variables('endTicks'),variables('startTicks')),36000000000)