Hi All,
I have question on sending the email using outlook.
Can someone help me how to add dynamic Header and Dynamic file each time when i save the reports on weekly basis,
Each week the week number changes from 1-52 and the file name includes the Week number.
eg:
Large_Deals_Details-FY23 P07-W3
Large_Deals_Details-FY23 P07-W4
Large_Deals_Details-FY23 P08-W1
Thanks in Advance.
Ranjan
Anil_G
(Anil Gorthi)
February 2, 2023, 7:06am
3
@ranjan.thammaiah
Use this to get the week number
Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(Now,Globalization.CalendarWeekRule.FirstFourDayWeek,DayOfWeek.Monday)
Remaining I believe you already figured out…Else let us know what you need can help
cheers
Hi @ranjan.thammaiah and welcome to the forums
to make a dynamic selection of the week, you could use the following function:
System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date_CheckWeek,System.Globalization.CalendarWeekRule.FirstFourDayWeek,DayOfWeek.Monday).ToString
This value will return the WeekNumber for the datetime stored in “date_CheckWeek”.
Example if we run for date_CheckWeek = Today:
Filename Created:
And changing the date to for example, 2 weeks ago:
then you just need to use the Filename variable to either attach it to the email, or build a dynamic header with it.
Reference code attached:
WeekNumber.xaml (6.4 KB)
Hope it helps!