kathyc2003
Programmer
Hello,
I wrote some custom code that resides on our Exchange server.
It is designed to copy items that are entered into their Microsoft Outlook calendar into the public folder calendar.
The code does prompts the user but the item does not get copied over.
Once we upgraded the server from SBS 2000 to SBS 2003the code had stopped working.
The server is running Windows SBS 2003 SP2 with Exchange SP2.
Everyone is using Outlook 2003.
Does anyone know why it would stop working?
Below is my code..
' Users may open a form, enter no data and close it.
' Use this flag.
Dim bolCloseNoSave
Function Item_Close()
' Check to see if user wants to close the form without saving.
If bolCloseNoSave = True Then
'Use want to close form and not save the data.
Else
' User wants to save the data.
Set MyNameSpace = Application.GetNameSpace("MAPI")
Set MyCurrentItem = Application.ActiveInspector.CurrentItem
' Make sure a category has been entered
If Len(MyCurrentItem.Categories) = 1 Then
Msg = "You must enter a category"
Title = "Category Missing!"
Response = MsgBox (Msg,1,Title)
' User wants to enter a category.
If Response = 1 Then
Item_Close = False
Exit Function
' User wants to close the form without saving.
Else
Item_Close = True
Exit Function
End If
Else
' Do Nothing
End If
End If
End Function
Function Item_Write()
Set MyNameSpace = Application.GetNameSpace("MAPI")
' If the user drags an appointment to a different date in the
' month calendar, an error will occur since the form is not
' open. Ignore the error and don't check for a category since
' the item could not have been saved originally without a
' category.
On Error Resume Next
Set MyCurrentItem = Application.ActiveInspector.CurrentItem
If Err = 424 Then Exit Function
' Reset the error handler
On Error GoTo 0
' Make sure a category has been entered
If Len(MyCurrentItem.Categories) = 1 Then
Msg = "You must enter a category"
Title = "Category Missing!"
Response = MsgBox (Msg,1,Title)
' User wants to enter a category.
If Response = 1 Then
Item_Write = False
Exit Function
' User wants to close the form without saving.
Else
bolCloseNoSave = True
Item_Write = False
' Close the form without saving changes.
MyCurrentItem.Close 1
Exit Function
End If
Else
' Do Nothing
End If
bolCloseNoSave = False
' Provide the user a dialog box asking whether or not the item should
' be saved to the Office Calendar
Msg = "Do you want to save this item on the Office Calendar?"
Title = "Calendar Message"
Response = Msgbox(Msg,4,Title)
If Response = 6 Then
' Set the BusyStatus property to Busy(2), the user wants to save to the
' Office Calendar.
MyCurrentItem.BusyStatus = 2
Else
' Set the BusyStatus to OutOfOffice(3) if the user does not want the item on the Office Calendar.
MyCurrentItem.BusyStatus = 3
End If
End Function
Function Item_Open()
' Set the Flag to close the form without saving to False.
bolCloseNoSave = False
End Function
I wrote some custom code that resides on our Exchange server.
It is designed to copy items that are entered into their Microsoft Outlook calendar into the public folder calendar.
The code does prompts the user but the item does not get copied over.
Once we upgraded the server from SBS 2000 to SBS 2003the code had stopped working.
The server is running Windows SBS 2003 SP2 with Exchange SP2.
Everyone is using Outlook 2003.
Does anyone know why it would stop working?
Below is my code..
' Users may open a form, enter no data and close it.
' Use this flag.
Dim bolCloseNoSave
Function Item_Close()
' Check to see if user wants to close the form without saving.
If bolCloseNoSave = True Then
'Use want to close form and not save the data.
Else
' User wants to save the data.
Set MyNameSpace = Application.GetNameSpace("MAPI")
Set MyCurrentItem = Application.ActiveInspector.CurrentItem
' Make sure a category has been entered
If Len(MyCurrentItem.Categories) = 1 Then
Msg = "You must enter a category"
Title = "Category Missing!"
Response = MsgBox (Msg,1,Title)
' User wants to enter a category.
If Response = 1 Then
Item_Close = False
Exit Function
' User wants to close the form without saving.
Else
Item_Close = True
Exit Function
End If
Else
' Do Nothing
End If
End If
End Function
Function Item_Write()
Set MyNameSpace = Application.GetNameSpace("MAPI")
' If the user drags an appointment to a different date in the
' month calendar, an error will occur since the form is not
' open. Ignore the error and don't check for a category since
' the item could not have been saved originally without a
' category.
On Error Resume Next
Set MyCurrentItem = Application.ActiveInspector.CurrentItem
If Err = 424 Then Exit Function
' Reset the error handler
On Error GoTo 0
' Make sure a category has been entered
If Len(MyCurrentItem.Categories) = 1 Then
Msg = "You must enter a category"
Title = "Category Missing!"
Response = MsgBox (Msg,1,Title)
' User wants to enter a category.
If Response = 1 Then
Item_Write = False
Exit Function
' User wants to close the form without saving.
Else
bolCloseNoSave = True
Item_Write = False
' Close the form without saving changes.
MyCurrentItem.Close 1
Exit Function
End If
Else
' Do Nothing
End If
bolCloseNoSave = False
' Provide the user a dialog box asking whether or not the item should
' be saved to the Office Calendar
Msg = "Do you want to save this item on the Office Calendar?"
Title = "Calendar Message"
Response = Msgbox(Msg,4,Title)
If Response = 6 Then
' Set the BusyStatus property to Busy(2), the user wants to save to the
' Office Calendar.
MyCurrentItem.BusyStatus = 2
Else
' Set the BusyStatus to OutOfOffice(3) if the user does not want the item on the Office Calendar.
MyCurrentItem.BusyStatus = 3
End If
End Function
Function Item_Open()
' Set the Flag to close the form without saving to False.
bolCloseNoSave = False
End Function