BillingInformation field

G

Guest

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(olFolderCalendar).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_Respaldo")
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_Respaldo")
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
 
M

Michael Bauer [MVP - Outlook]

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(olFolderCalendar).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_Respaldo")
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_Respaldo")
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
 
G

Guest

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(olFolderCalendar).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_Respaldo")
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_Respaldo")
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
 
M

Michael Bauer [MVP - Outlook]

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(olFolderCalendar).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_Respaldo")
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_Respaldo")
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top