![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi
I have some code that copies an appointment from one calendar to another (a different PST ) and it works fine when you create that appointment. What I need to do now is to reflect changes in the original appointment into the second one, but I need to make sure that no matter what is changed in the appointment, the "find" method still can find the copy of the appointment. For example I can´t do the search based in date, subject or status since I can´t trap the event before the change has taken place so the "find" method would fail to find the record in the second calendar. To do this I used the billinginformation field to put some data that would identify both the original and the copied record. The problem is that the code seems to write the information in the field of both appointments but when I retrieve the field of the changed appointment it is shown in blank (no data in it) so the find method fails. Anybody knows why the value is not kept in the field? Thanks. Attached you will find the coding Dim myOlApp As New Outlook.Application Public WithEvents CalendarItems As Outlook.Items Public Sub Initialize_handler() Set CalendarItems = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFo lderCalendar).Items End Sub Private Sub Application_Startup() Initialize_handler End Sub Private Sub CalendarItems_Itemadd(ByVal Item As Object) Dim mycopiedappt As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Item.BillingInformation = Item.LastModificationTime MsgBox Item.BillingInformation Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") Set mycopiedappt = Item.Copy MsgBox mycopiedappt.BillingInformation mycopiedappt.Move OPalmFolder End Sub Private Sub CalendarItems_Itemchange(ByVal Item As Object) Dim mychgappt As Outlook.AppointmentItem Dim OCalItem As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Dim OStr As String Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") OStr = "[BillingInformation]=" & Item.BillingInformation '(here the item.billinginformation data returns blank or "" Set OCalItem = OPalmFolder.Items.Find("[BillingInformation]=" & Item.BillingInformation) If TypeName(OCalItem) "Nothing" Then OCalItem.Delete Set mychgappt = Item.Copy mychgappt.Move OPalmFolder Else MsgBox "Can´t find corresponding appointment" End If End Sub |
Ads |
#2
|
|||
|
|||
![]()
Am Fri, 4 Aug 2006 11:04:02 -0700 schrieb Juan J:
Instead: Set OCalItem = OPalmFolder.Items.Find("[BillingInformation]=" & Item.BillingInformation) This change should do it: .....Find("[BillingInformation]='" & Item.BillingInformation & "'") -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- Hi I have some code that copies an appointment from one calendar to another (a different PST ) and it works fine when you create that appointment. What I need to do now is to reflect changes in the original appointment into the second one, but I need to make sure that no matter what is changed in the appointment, the "find" method still can find the copy of the appointment. For example I can´t do the search based in date, subject or status since I can´t trap the event before the change has taken place so the "find" method would fail to find the record in the second calendar. To do this I used the billinginformation field to put some data that would identify both the original and the copied record. The problem is that the code seems to write the information in the field of both appointments but when I retrieve the field of the changed appointment it is shown in blank (no data in it) so the find method fails. Anybody knows why the value is not kept in the field? Thanks. Attached you will find the coding Dim myOlApp As New Outlook.Application Public WithEvents CalendarItems As Outlook.Items Public Sub Initialize_handler() Set CalendarItems = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFo lderCalendar).Items End Sub Private Sub Application_Startup() Initialize_handler End Sub Private Sub CalendarItems_Itemadd(ByVal Item As Object) Dim mycopiedappt As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Item.BillingInformation = Item.LastModificationTime MsgBox Item.BillingInformation Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") Set mycopiedappt = Item.Copy MsgBox mycopiedappt.BillingInformation mycopiedappt.Move OPalmFolder End Sub Private Sub CalendarItems_Itemchange(ByVal Item As Object) Dim mychgappt As Outlook.AppointmentItem Dim OCalItem As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Dim OStr As String Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") OStr = "[BillingInformation]=" & Item.BillingInformation '(here the item.billinginformation data returns blank or "" Set OCalItem = OPalmFolder.Items.Find("[BillingInformation]=" & Item.BillingInformation) If TypeName(OCalItem) "Nothing" Then OCalItem.Delete Set mychgappt = Item.Copy mychgappt.Move OPalmFolder Else MsgBox "Can´t find corresponding appointment" End If End Sub |
#3
|
|||
|
|||
![]()
Thanks for the tip,
the problem is that the object has a "" value (if I do a msgbox to the Item.BillingInformation sentence, it prints an empty box) For some reason the recorded value in the field gets erased. Thanks "Michael Bauer [MVP - Outlook]" escribió: Am Fri, 4 Aug 2006 11:04:02 -0700 schrieb Juan J: Instead: Set OCalItem = OPalmFolder.Items.Find("[BillingInformation]=" & Item.BillingInformation) This change should do it: .....Find("[BillingInformation]='" & Item.BillingInformation & "'") -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- Hi I have some code that copies an appointment from one calendar to another (a different PST ) and it works fine when you create that appointment. What I need to do now is to reflect changes in the original appointment into the second one, but I need to make sure that no matter what is changed in the appointment, the "find" method still can find the copy of the appointment. For example I can´t do the search based in date, subject or status since I can´t trap the event before the change has taken place so the "find" method would fail to find the record in the second calendar. To do this I used the billinginformation field to put some data that would identify both the original and the copied record. The problem is that the code seems to write the information in the field of both appointments but when I retrieve the field of the changed appointment it is shown in blank (no data in it) so the find method fails. Anybody knows why the value is not kept in the field? Thanks. Attached you will find the coding Dim myOlApp As New Outlook.Application Public WithEvents CalendarItems As Outlook.Items Public Sub Initialize_handler() Set CalendarItems = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFo lderCalendar).Items End Sub Private Sub Application_Startup() Initialize_handler End Sub Private Sub CalendarItems_Itemadd(ByVal Item As Object) Dim mycopiedappt As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Item.BillingInformation = Item.LastModificationTime MsgBox Item.BillingInformation Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") Set mycopiedappt = Item.Copy MsgBox mycopiedappt.BillingInformation mycopiedappt.Move OPalmFolder End Sub Private Sub CalendarItems_Itemchange(ByVal Item As Object) Dim mychgappt As Outlook.AppointmentItem Dim OCalItem As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Dim OStr As String Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") OStr = "[BillingInformation]=" & Item.BillingInformation '(here the item.billinginformation data returns blank or "" Set OCalItem = OPalmFolder.Items.Find("[BillingInformation]=" & Item.BillingInformation) If TypeName(OCalItem) "Nothing" Then OCalItem.Delete Set mychgappt = Item.Copy mychgappt.Move OPalmFolder Else MsgBox "Can´t find corresponding appointment" End If End Sub |
#4
|
|||
|
|||
![]()
Am Sat, 5 Aug 2006 16:25:01 -0700 schrieb Juan J:
Did you try an Item.Save? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- Thanks for the tip, the problem is that the object has a "" value (if I do a msgbox to the Item.BillingInformation sentence, it prints an empty box) For some reason the recorded value in the field gets erased. Thanks "Michael Bauer [MVP - Outlook]" escribió: Am Fri, 4 Aug 2006 11:04:02 -0700 schrieb Juan J: Instead: Set OCalItem = OPalmFolder.Items.Find("[BillingInformation]=" & Item.BillingInformation) This change should do it: .....Find("[BillingInformation]='" & Item.BillingInformation & "'") -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- Hi I have some code that copies an appointment from one calendar to another (a different PST ) and it works fine when you create that appointment. What I need to do now is to reflect changes in the original appointment into the second one, but I need to make sure that no matter what is changed in the appointment, the "find" method still can find the copy of the appointment. For example I can´t do the search based in date, subject or status since I can´t trap the event before the change has taken place so the "find" method would fail to find the record in the second calendar. To do this I used the billinginformation field to put some data that would identify both the original and the copied record. The problem is that the code seems to write the information in the field of both appointments but when I retrieve the field of the changed appointment it is shown in blank (no data in it) so the find method fails. Anybody knows why the value is not kept in the field? Thanks. Attached you will find the coding Dim myOlApp As New Outlook.Application Public WithEvents CalendarItems As Outlook.Items Public Sub Initialize_handler() Set CalendarItems = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFo lderCalendar).Items End Sub Private Sub Application_Startup() Initialize_handler End Sub Private Sub CalendarItems_Itemadd(ByVal Item As Object) Dim mycopiedappt As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Item.BillingInformation = Item.LastModificationTime MsgBox Item.BillingInformation Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") Set mycopiedappt = Item.Copy MsgBox mycopiedappt.BillingInformation mycopiedappt.Move OPalmFolder End Sub Private Sub CalendarItems_Itemchange(ByVal Item As Object) Dim mychgappt As Outlook.AppointmentItem Dim OCalItem As Outlook.AppointmentItem Dim PalmFolder As Outlook.Folders Dim OPalmFolder As Outlook.MAPIFolder Dim OStr As String Set OPalmFolder = myOlApp.GetNamespace("MAPI").Folders.Item("PALM_Re spaldo") Set PalmFolder = OPalmFolder.Folders Set OPalmFolder = PalmFolder.Item("Calendar(PALM)") OStr = "[BillingInformation]=" & Item.BillingInformation '(here the item.billinginformation data returns blank or "" Set OCalItem = OPalmFolder.Items.Find("[BillingInformation]=" & Item.BillingInformation) If TypeName(OCalItem) "Nothing" Then OCalItem.Delete Set mychgappt = Item.Copy mychgappt.Move OPalmFolder Else MsgBox "Can´t find corresponding appointment" End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I export Notes field from Contact records in one field? | Deb | Outlook - Using Contacts | 4 | August 28th 06 09:12 PM |
move phone numbers from company field to business field | Tyson | Outlook and VBA | 3 | June 9th 06 06:38 PM |
Adding Follow Up field to Field Chooser Programatically. | c | Outlook and VBA | 3 | February 25th 06 03:10 PM |
Populate Company field from Contact field in custom task form | Sue Mosher [MVP-Outlook] | Outlook - Using Forms | 0 | January 20th 06 08:37 PM |
rename 'User Field 1' field ? | E-Double | Outlook - Installation | 1 | January 16th 06 04:38 PM |