![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have searched long and hard for an example of Opal code to modify an existing MS Outlook Appointment using OLE. What puzzles me is that plenty of people have asked the same question (albeit not that often with Paradox) over the years and there are very few detailed examples of how to find an appointment and modify it or delete it. This contrasts with the trumpeted details showing how easy it is to create a new appointment in Outlook using OLE! Generally, people who ask about modifying and deleting are met with a deafening silence. It is enough to make me think there is a conspiracy against knowing this information. Yet it is fairly cruical to applying this functionality in a real world application. I have seen code showing how to do this in other languages but I am realy only familiar with Opal (I'm not a professional programmer) so I would need to give more time than is warranted to sort out the equivalent Opal code. I have been trying to check thedbcommunity for a couple of days but the web site seems to be down. So if any body is willing to share their code with me I would be eternally gratetful. Regards Paul |
#3
| |||||||||||||||||||||||||
| |||||||||||||||||||||||||
|
|
Show the code used to instantiate the Namespace and to save the items and get their EntryIDs. GetItemFromID returns an object. You need to use Set: |
|
Set CalEntryIDR = objNS.GetItemFromID(CalEntryID) |
|
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx |
|
"Andy" <A... (AT) discussions (DOT) microsoft.com> wrote in message news:F52F1C45-D96D-416F-8B3F-77EA651E7B0F (AT) microsoft (DOT) com... Sue - Sorry to push a bit more on this subject but it is interesting. Firstly, I took your advice and looked at the VBA help files to work out the syntax of the various methods. I did struggle with Namespace though and found that I had to use Session instead. |
|
Anyway - I created 3 Appointment items one after the other and saved each before obtaining their EntryID - suprisingly each EntryID was the same even though the 3 appointments were on different days albeit with the same Subject for each. |
|
I stored these away but when I came to later use them to delete the appointments, I got a failure when I tried to set a variable as follows :- |
|
CalEntryIDR = objOutlook.Session.GetItemFromID(CalEntryID) ' CalEntryID is the long EntryID value |
|
Also when I actually got this statement to work (just after creating the appointment) the returned value was the Subject of the appointment ??? |
|
Any ideas? Especially the difference between Namespace and Session and why the 3 IDs were the same above. |
|
Thanks. |
|
The variable CalEntryID contains the long EntryID value. "Sue Mosher [MVP-Outlook]" wrote: |
|
When in doubt, check the object browser: Press ALt+F11 to open the VBA environment in Outlook, then press F2. Switch from <All Libraries> to Outlook to browse all Outlook objects and their properties, methods, and events. Select any object or member, then press F1 to see its Help topic. |
|
"Andy" <A... (AT) discussions (DOT) microsoft.com> wrote in message news:56FDB3C3-9810-4877-A442-D7F393FC8AE7 (AT) microsoft (DOT) com... Thanks Sue - good idea. |
|
I'm OK with obtaining and storing the EntryID for later use but could you help more with the syntax with Namespace.GetItemFromID and AppointmentItem.Delete - I'm not so familar with these two contructs. |
|
Regards - Andy. |
|
"Sue Mosher [MVP-Outlook]" wrote: |
|
Delete it in what context? If you get the item's EntryID after saving it and store that in your Access database, you can return the same item with the Namespace.GetItemFromID and then delete it with the AppointmentItem.Delete method. |
|
"Andy" <A... (AT) discussions (DOT) microsoft.com> wrote in message news B7F9858-6C2B-4E9B-A3EF-260AB285A1E8 (AT) microsoft (DOT) com...I have successfully added an All Day appointment for tomorrow in Outlook from Access using :- |
|
-------------- |
|
Dim objOutlook As Outlook.Application Dim objCalendar As Object Dim objAppointment As Object |
|
Set objOutlook = New Outlook.Application Set objCalendar = objOutlook.Session.GetDefaultFolder(olFolderCalend ar) |
|
Set objAppointment = objCalendar.Items.Add With objAppointment .Subject = "Test" .Start = Date + 1 .AllDayEvent = True End With objAppointment.Close olSave Set objAppointment = Nothing Set objOutlook = Nothing |
|
--------- |
|
Can anyone help me with the code to delete the same appointment using VBA? |
|
Thanks. |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |