Re: Script to Delete Calendar Entry
- From: Phil <Phil@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 19 Jan 2007 13:45:03 -0800
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
- Follow-Ups:
- Re: Script to Delete Calendar Entry
- From: Sue Mosher [MVP-Outlook]
- Re: Script to Delete Calendar Entry
- References:
- Re: Script to Delete Calendar Entry
- From: Sue Mosher [MVP-Outlook]
- Re: Script to Delete Calendar Entry
- From: Phil
- Re: Script to Delete Calendar Entry
- From: Sue Mosher [MVP-Outlook]
- Re: Script to Delete Calendar Entry
- Prev by Date: Re: Processing New messages
- Next by Date: Re: Script to Delete Calendar Entry
- Previous by thread: Re: Script to Delete Calendar Entry
- Next by thread: Re: Script to Delete Calendar Entry
- Index(es):
Relevant Pages
|