Email weekly calendar summary

Status
Not open for further replies.

Ganesh

New Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server 2010
David Lee in Quora.com has written a VBScript on how to send email summary of Outlook calendar. With minor adjustment to the code I am able to make it read non-default calendars (so basically in Outlook 2010, under My Calendars section I have added one more calendar called 'Test Calendar' and I want the scrip to send email summary of the 'Test Calendar' rather than my default calendar called 'Calendar'). But now is if I add the lines to read the non default calendar i.e. 'Test Calendar' the date filter does not apply - it sends summary of whole calendar rather than 7 days. I have no experience in VB so I would very grateful if anyone could look at it and see what I need to change to make it work. If you are feeling awfully generous I would also like code added so it only sends email if it finds anything during the specified date range rather than just sending email with no events. The lines I have added to export 'Test Calendar' are in bold and the original line is commented out.

-----
Const olCalendarMailFormatDailySchedule = 1
Const olFreeBusyAndSubject = 1
Const olFullDetails = 2
Const olFolderCalendar = 9

SendAgenda "someone@someone.com", Date, DateAdd("d", 7, Date)

Sub SendAgenda(strAdr, datBeg, datEnd)
Dim olkApp, olkSes, olkCal, olkExp, olkMsg

Set olkApp = CreateObject("Outlook.Application")
Set olkSes = OlkApp.GetNameSpace("MAPI")
olkSes.Logon olkApp.DefaultProfileName
Set olkCal = olkSes.GetDefaultFolder(olFolderCalendar)

Set olkCalFolder = olkCal.Folders("Test Calendar")
Set olkExp = olkCalFolder.GetCalendarExporter


'Set olkExp = olkCal.GetCalendarExporter

With olkExp
.CalendarDetail = olFreeBusyAndSubject
.RestrictToWorkingHours = False
.StartDate = datBeg
.EndDate = datEnd
End With
'msgbox "Email Sent"
Set olkMsg = olkExp.ForwardAsICal(olCalendarMailFormatDailySchedule)
With olkMsg
.To = strAdr
.Send
End With

Set olkCal = Nothing
Set olkExp = Nothing
Set olkMsg = Nothing
olkSes.Logoff
Set olkSes = Nothing
Set olkApp = Nothing
End Sub
-----
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
i think its Set olkExp = olkCal.GetCalendarExporter -

The GetCalendarExporter method automatically sets the defaults for the CalendarSharing class to the standard default options used by the Folder object.

if i share calendar manually, the default for a secondary calendar is whole calendar, for the default calendar it's one day.

I don't know if there is a way to avoid it but will look into it tomorrow.
 

Ganesh

New Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server 2010
Thanks Diane.

At the moment if I let the script use default calendar the date range works but as soon as I add the line to specify 'Test Calendar' it just emails the whole calendar. When I say whole calendar I mean if I had one entry made in 1 May and another is made in 1 Sep, it'll send whole that period summary ignoring the date range today to 7 days in future.

Just copy and past this (for default calendar) and you'll see it works perfectly.

Const olCalendarMailFormatDailySchedule = 0
Const olFreeBusyAndSubject = 1
Const olFullDetails = 2
Const olFolderCalendar = 9

SendAgenda "someone@someone.com", Date, DateAdd("d", 1, Date)

Sub SendAgenda(strAdr, datBeg, datEnd)
Dim olkApp, olkSes, olkCal, olkExp, olkMsg

Set olkApp = CreateObject("Outlook.Application")
Set olkSes = OlkApp.GetNameSpace("MAPI")
olkSes.Logon olkApp.DefaultProfileName
Set olkCal = olkSes.GetDefaultFolder(olFolderCalendar)
Set olkExp = olkCal.GetCalendarExporter

With olkExp
.CalendarDetail = olFreeBusyAndSubject
'.IncludeAttachments = True
'.IncludePrivateDetails = True
.RestrictToWorkingHours = False
.StartDate = datBeg
.EndDate = datEnd
End With
'msgbox "Email summary sent"
Set olkMsg = olkExp.ForwardAsICal(olCalendarMailFormatDailySchedule)
With olkMsg
.To = strAdr
.Send
End With

Set olkCal = Nothing
Set olkExp = Nothing
Set olkMsg = Nothing
olkSes.Logoff
Set olkSes = Nothing
Set olkApp = Nothing
End Sub
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
R Outlook 2010 How do you export 2 email Accounts' 2010 Inbox Files to new computer (2019)? Using Outlook 0
R Auto display of new email does not work on non-default account Outlook VBA and Custom Forms 0
J Automatically forward email and apply template Outlook VBA and Custom Forms 0
L Outlook saved email templates Using Outlook 1
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
T How can you include Junk Email in Search Results like you can include Deleted Items? Using Outlook 3
B Extracting email addresses from a folder - how to also get the name of the person the address is for? Using Outlook 5
W Replyin to the reply-to email address Outlook VBA and Custom Forms 0
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
M Extract all links from Outlook email, send to Excel Using Outlook 2
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
B Outlook 2003 email sending & receiving suddenly stopped working Using Outlook 3
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
T The non-email functions Using Outlook 8
P Outlook 2013 Word Share doc as Email Attachment now brings up Eudora. Using Outlook 1
C How to rename subject line and forward the email Outlook VBA and Custom Forms 2
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0
J Outlook Reply > From > Other Email Address... > Address Not Showing in Sent Items... From Email Outlook VBA and Custom Forms 0
T Column to display which email alias a message was sent to Outlook VBA and Custom Forms 6
Marc2019 Need help please! Cannot Setup my outlook email account on my Mac Outlook 2011 Using Outlook.com accounts in Outlook 2
HarvMan Hotmail - Sending email is undeliverable Using Outlook 4
R Error when trying to forward current email item Outlook VBA and Custom Forms 7
H In outlook 365 POP mail Inbox, email takes a long time or never arrives. Using Outlook 1
D Can Exchange Admin Center create a pst for users email/contacts/calendar? Exchange Server Administration 0
T After I send a new email, it remains in the Draft folder Using Outlook.com accounts in Outlook 3
P OWA Settings->Calendar->Events from Email; Setting changes do not hold Using Outlook 1
S How to export urls from email to excel and check the status of the url ? New Slipstick.com Articles 6
P Auto Insert Current Date or Time into Email Subject Outlook VBA and Custom Forms 2
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
M ERROR: None of your email accounts could send to this recipient Using Outlook 2
S save email from excel Outlook VBA and Custom Forms 1
T How can we view Blocked email addresses Using Outlook 6
F My hotmail calendar is not syncing with my outlook but my email is Using Outlook 3
O Multiple email accounts - hesitate to create a new profile Using Outlook 3
9 Outlook 2016 How to save an Outlook attachment to a specific folder then delete the email it came from? Using Outlook 1
C Outlook Autocomplete suggestions showing wrong person's name against an email address Using Outlook 0
T Outlook converts sent email to txt attachments when sync Using Outlook 0
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
glnz How set up new IMAP on Outlook-Office 365 and merge in pst from Outlook 2003 for same two email accounts? Using Outlook 5
R VBA for copying sent email to current folder under a shared mailbox Outlook VBA and Custom Forms 17
ChrisK2 Send email to advertise@slipstick.com fails: "The group advertising isn't set up to receive messages from..." Using Outlook 3
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
A Created a new user account and the local account cannot see email Using Outlook 3
N Outlook 365 Email Notifications Using Outlook 0
Randy Redekopp How To Merge Contact Info to Email Custom Form Template Using Outlook 2
A Outlook 2019 having issues with 'people search' and not making suggestions in email To: etc Using Outlook 12
T Cannot connect to main BT email account, sub accts okay Using Outlook 0
M Outlook email window maximizes improperly Using Outlook 3
Similar threads


















































Top