Hi, I wonder if anyone has had a similar problem to me. I have written an Intranet application that allows staff to book annual leave, sick leave etc. The data is maintained in its own SQL Server DB, however I also wish to insert Appointment entries into outlook for the leave requested.
The appointment entry works fine when developing and running on my machine - I can create entries for myself and others (when the ASPNET account has the suitable permission). If however someone else runs the app remotely (i.e. logs on to my machine) the application hangs and my Outlook has to repair itself (tries to open in Safe mode - fails, then repairs itself, then I have to re-boot). I have no previous experience working with Outlook so am at a loss. Any help greatly appreciated.
Cheers
Gord
The code I am running is as follows:
=================================================================
Dim objUserFunctions As New UserFunctions()
determine the user ids
If Not objUserFunctions.GetUserLogins(Session, User,
mstrUserID, mstrUserAuditID) Then
Response.Redirect(AMS_INVALID_USER_PAGE &
"?Direction=Unauthenticated User", False)
End If
Try
Dim objOLApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objApptItem As Outlook.AppointmentItem
Dim objRecipient As Outlook.Recipient
objOLApp = CreateObject("Outlook.Application")
objNameSpace = objOLApp.GetNamespace("MAPI")
objRecipient = objNameSpace.CreateRecipient(mstrUserID)
objFolder = _
objNameSpace.GetSharedDefaultFolder _
(objRecipient,
Outlook.OlDefaultFolders.olFolderCalendar)
objApptItem =
objFolder.Items.Add(Outlook.OlItemType.olAppointmentItem)
objApptItem.AllDayEvent = True
objApptItem.Start = CDate("14 April 2003")
objApptItem.End = CDate("19 April 2003")
objApptItem.Body = "Poppys Birthday"
objApptItem.Subject = "Leave"
objApptItem.Save()
Me.txtErrorDisplay.Text = "Leave Appointment created"
objOLApp = Nothing
objApptItem = Nothing
Catch objErr As Exception
Not real error handler
Console.Write(objErr.Message)
End Try
The appointment entry works fine when developing and running on my machine - I can create entries for myself and others (when the ASPNET account has the suitable permission). If however someone else runs the app remotely (i.e. logs on to my machine) the application hangs and my Outlook has to repair itself (tries to open in Safe mode - fails, then repairs itself, then I have to re-boot). I have no previous experience working with Outlook so am at a loss. Any help greatly appreciated.
Cheers
Gord
The code I am running is as follows:
=================================================================
Dim objUserFunctions As New UserFunctions()
determine the user ids
If Not objUserFunctions.GetUserLogins(Session, User,
mstrUserID, mstrUserAuditID) Then
Response.Redirect(AMS_INVALID_USER_PAGE &
"?Direction=Unauthenticated User", False)
End If
Try
Dim objOLApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objApptItem As Outlook.AppointmentItem
Dim objRecipient As Outlook.Recipient
objOLApp = CreateObject("Outlook.Application")
objNameSpace = objOLApp.GetNamespace("MAPI")
objRecipient = objNameSpace.CreateRecipient(mstrUserID)
objFolder = _
objNameSpace.GetSharedDefaultFolder _
(objRecipient,
Outlook.OlDefaultFolders.olFolderCalendar)
objApptItem =
objFolder.Items.Add(Outlook.OlItemType.olAppointmentItem)
objApptItem.AllDayEvent = True
objApptItem.Start = CDate("14 April 2003")
objApptItem.End = CDate("19 April 2003")
objApptItem.Body = "Poppys Birthday"
objApptItem.Subject = "Leave"
objApptItem.Save()
Me.txtErrorDisplay.Text = "Leave Appointment created"
objOLApp = Nothing
objApptItem = Nothing
Catch objErr As Exception
Not real error handler
Console.Write(objErr.Message)
End Try