Re: Script to Delete Calendar Entry

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yes, HR likes to change dates for things so although I may put an entry on
everyone's calendar today for Timesheets being due on october 1st 2007 at
9:00 A.M., HR may move the date to october 3rd 2007 at 9:00 A.M. So then I
would need to go back and delete the entry for October 1st 2007. I guess the
criteria would be the title or the date and time. Thanks!

"Sue Mosher [MVP-Outlook]" wrote:

I need the code to delete it just in case HR
changes a date on me!

Do you mean that you might want to delete an item much, much later? That was not apparent from your original post. You would need to retrieve the item based on some identifying characteristic. We don't know what that might be in your scenario. Once you figure out what distinguishes the items, you'd use the MAPIFolder.Items.Find or Restrict method to locate the item(s), then delete them. Both those methods are well documented in Help.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Phil" <Phil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:631AE9BA-ED6C-4D25-B13C-D13C74ED224E@xxxxxxxxxxxxxxxx
Thanks for the reply. Where would I place it in the code and what would I
take out? I am sorry, I don't know anything about vb scripting.

To answer your question, the original script is going to be deployed through
active directory so that I could put reminders for timesheets and expense
reports on everyones calendar. I need the code to delete it just in case HR
changes a date on me! Thanks for your help.

Phil

"Sue Mosher [MVP-Outlook]" wrote:

objEvents.Delete

Why would you want to delete the appointment your code just created?

"Phil" <Phil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:7A46E0CC-64DA-4AFD-B10A-1C1AA25BBF48@xxxxxxxxxxxxxxxx
I have this sample script that I modifed from here:
http://www.microsoft.com/technet/scriptcenter/resources/officetips/sept05/tips0929.mspx

The modifed script is below. It works fine, but what I need to know is how
to change the code to delete the items it created. Thanks!

Const olFolderCalendar = 9
Const olAppointmentItem = 1

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar)

Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "January 18, 2007", "Time Sheets Due"
objDictionary.Add "January 31, 2007", "Time Sheets Due"

colKeys = objDictionary.Keys

For Each strKey in colKeys
dtmEventsDate = strKey
strEventsName = objDictionary.Item(strKey)

Set objEvents = objOutlook.CreateItem(olAppointmentItem)
objEvents.Subject = strEventsName
objEvents.Start = dtmEventsDate & " 9:00 AM"
objEvents.End = dtmEventsDate & " 9:00 AM"
objEvents.AllDayEvent = False
objEvents.ReminderSet = True
objEvents.ReminderMinutesBeforeStart = 300
objEvents.BusyStatus = Free
objEvents.Save
Next


.



Relevant Pages

  • Re: All day events only show up for first day
    ... The purpose of the script is to look through a team calendar (in a shared ... As it stands, if there is a 3-day event that spans Mon, Tue, and Wed, the ... one entry for it in the calendar, and since the entry has a start date of ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: 4x10 calendar problem
    ... Take a look at the FAQs entry on Default Working Hours at the URL in my signature. ... The entry on the Tools Options Calendar page labels "Hours per Day" is the conversion factor that Project uses to convert a entry typed in in "days" into the required hours to store in the database. ... So if your working time calendar has hours of work 7am to 6pm MTWT with an hour for lunch but you have left the "hours per day" at the default 8 and you enter a task with a duration of "4 days," that task duration is converted to 4x8 or 32 hours. ...
    (microsoft.public.project)
  • Re: 409 status code response from WebDAV appointment msg
    ... Hi Lee, Thanks for the response. ... We are POSTing to a particular users calendar subfolder with the intention ... >> server in order to create a new Calendar entry. ... What URL are you posting to? ...
    (microsoft.public.exchange.development)
  • Re: Add Outlook Appointments through MS Outlook
    ... an Access form. ... > ApptTime, etc. referes to the fields on a form created in access. ... > pull the info from that form and send it to the calendar. ... The entry is only 15 minutes long no matter what the duration I set ...
    (microsoft.public.outlook.program_vba)
  • Reading a Custom Appointment Items Conflict Property in Item_Write Function
    ... I want to check that a new item to be added to my calendar does not ... I thought about using the .Conflicts property as shown: ... MsgBox "The schedule entry cannot conflict with an existing entry. ...
    (microsoft.public.outlook.program_forms)