![]() |
BillingInformation field
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 |
BillingInformation field
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 |
BillingInformation field
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 |
BillingInformation field
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 |
All times are GMT +1. The time now is 03:32 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com