Automate the sending of an Outlook 2010 calendaer

LouSch7
LouSch7 used Ask the Experts™
on
At the end of everyday we send an email of the HelpDesk calendar detailing tomorrow's events.  Right now we have to rely on someone to physically do this.  It's designed to be a reminder of what needs to be done tomorrow.

Is there anyway to automate this process?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2012
Commented:
Althought you can setup an automated email, using Scheduled Tasks and Mapisend
I think the trouble you may run into is sending the copy of the next days, or current days calednar attached to it....

If you have OWA setup and running on exchange you could
Setup an Automated Email Msg to be sent

IN the Body include the URL to the shared helpdesk calendar using the URL Below for they type of calendar view you would ike to send


Calendar View – Default – Daily
 
https://<server name>/owa/<SMTP address>/?cmd=contents&module=calendar
 

Calendar View – Daily
 
https://<server name>/owa/<SMTP address>/?cmd=contents&f=Calendar&view=Daily
 


Calendar View – Weekly
 
https://<server name>/owa/<SMTP address>/?cmd=contents&f=Calendar&view=Weekly
 


Calendar View – Daily – Specific Date by specifying Date, Month and Year


https://<server name>/owa/<SMTP address>/?cmd=contents&f=Calendar&view=Daily&d=3&m=7&y=2009

d=[1-31]
m=[1-12]
y=[four digit year]


Then all the user needs to do is open the email, click on the URL and have the shared calendar open in owa

Alternatively, you could just have a tool that forwards that days reminders to the users for the Calendar
 
http://www.slipstick.com/addins/calendar-tools-addins/calendar-reminder-tools-for-outlook/

Author

Commented:
So, I guess the follow up question or thought would be...

Is it possible to script something that pulls the event details for the following day and put that into the body of an email and send?
Top Expert 2012

Commented:
Can you use the OWA URLs for the Calendar?

If so you can use mapisend.

Download MAPISEND and save to C Drive
http://www.softpedia.com/get/Internet/E-mail/E-mail-Clients/MAPISend.shtml

Then
Create a BAt file with

@ECHO OFF

c:\mapisend -u "outlook" -p anything -r Recipientemail@domain.com -c CopytoEmail@domain.com -s "Email Subject" -t c:\File location of EamilBody.doc

Create a word doc with the details or body of your email including the link to the OWA Calendar url above

Save it as C:\Emailbody.doc

Then add your bat file to scheduled tasks when you want it to run

ON the machine its running on you will need to allow access when run

Or you can use click yes
http://www.contextmagic.com/express-clickyes/

However, should anything malicious want to access your email to send items, click yes will allow it to run
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Author

Commented:
MAPISend does look nice however, I already have a solution in place for sending out customized email reports on one of our web servers.  So, sending the email isn't the issue; it's more so getting the data into the email that is.

As far as I understand it, the OWA urls are for public/shared calendars only.  Our HelpDesk calendar is the calendar associated with the HelpDesk account which is a physical mailbox which we all have access to.
Commented:
I've decided to stay away from the idea of automating this functionality and instead was able to devise a way to deploy a CustomAddIn for Outlook that accomplishes what we needed with One-Click functionality.

The CustomAddIn calls on the attached VB code to send out the email.  This allows all of our sys admins to be able to send out the email on any given day at any given time so this accounts for our primary being out, early outs and holidays.

    Private Sub DailyHelpDeskReport_Click(sender As System.Object, e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles DailyHelpDeskReport.Click
        Dim objOutlook
        Dim objNameSpace
        Dim objFolder
        Dim HelpDeskFolder
        Dim MyItems
        Dim CurrentAppointment
        Dim strOutput
        Dim strOutput2
        Dim dtLastWeek As Date
        Dim dtNextWeek As Date
        Dim icount
        Dim objMsg

        Const olMailItem = 0
        Const olFolderCalender = 9

        'Create Outlook, Namespace, Folder Objects and Task Item
        objOutlook = CreateObject("Outlook.application")
        objNameSpace = objOutlook.GetNamespace("MAPI")
        objFolder = objNameSpace.GetDefaultFolder(olFolderCalender)
        HelpDeskFolder = objNameSpace.Folders("HelpDesk").Folders("Calendar")
        MyItems = HelpDeskFolder.Items

        Today = System.DateTime.Now
        Today = Today.ToShortDateString
        dtLastWeek = Today
        dtNextWeek = Today.AddDays(2)
        strOutput = "<h2>Meetings For Tomorrow</h2>"
        strOutput2 = ""
        icount = 0
        For Each CurrentAppointment In MyItems
            If CurrentAppointment.BusyStatus = 2 And CurrentAppointment.Sensitivity = 0 Then
                If CurrentAppointment.Start >= dtLastWeek And CurrentAppointment.Start <= dtNextWeek Then
                    icount = icount + 1
                    strOutput2 = strOutput2 & icount & ". " & CurrentAppointment.Subject & vbTab & " <b>Time:</b> " & CurrentAppointment.Start & " <b>Duration</b> " & CurrentAppointment.Duration & " .mins" & vbCrLf
                End If
            End If
        Next

        If icount > 1 Then
            strOutput = strOutput & strOutput2 & vbCrLf & vbCrLf
        End If

        icount = 0
        For Each CurrentAppointment In MyItems
            If CurrentAppointment.BusyStatus = 2 And CurrentAppointment.Sensitivity = 0 Then
                If CurrentAppointment.Start >= dtLastWeek And CurrentAppointment.Start <= dtNextWeek Then
                    icount = icount + 1
                    strOutput = strOutput & icount & ". " & CurrentAppointment.Subject & vbTab & " <b>Time:</b> " & CurrentAppointment.Start & " <b>Duration</b> " & CurrentAppointment.Duration & " .mins" & vbCrLf
                    If Len(CurrentAppointment.Body) > 0 Then
                        strOutput = strOutput & "<blockquote><b>Notes: </b>" & CurrentAppointment.Body & "</blockquote>" & vbCrLf & vbCrLf
                    Else
                        strOutput = strOutput & vbCrLf
                    End If
                End If
            End If
        Next

        objMsg = objOutlook.CreateItem(olMailItem)

        objMsg.To = "email@domain.com" ' your reminder notification address
        objMsg.Subject = "Status Report For " & Today.AddDays(1)
        objMsg.Display()
        strOutput = Replace(strOutput, vbCrLf, "<br>")
        objMsg.HTMLBody = strOutput
        objMsg.Send()

        'Clean up
        objFolder = Nothing
        HelpDeskFolder = Nothing
        objNameSpace = Nothing
        objOutlook = Nothing
        objMsg = Nothing
    End Sub

Open in new window


I accomplished this after modifying the examples found here: http://www.serverwatch.com/tutorials/article.php/1475631/Using-VBScript-to-Pull-Meetings-from-Outlook.htm

Author

Commented:
In the end I stayed away from the automated solution altogether. However, the first/initial response I received helped me greatly in researching/developing and testing my final solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial