I'm trying to write a program that will take input and create an appointment in a shared calendar. The code I have will allow me to create an appointment in my own calendar, but I'm not sure what line of code I need to change it to the shared one.
Thanks
Private Sub btnEnterDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterDate.Click
02
03 Dim olApp As Outlook.Application
04 olApp = CreateObject("Outlook.Application")
05
06 Dim olNs As Outlook.NameSpace
07 olNs = olApp.GetNamespace("MAPI")
08 olNs.Logon()
09
10 Dim strUserName As String
11 Dim strBlackberryNumber As String
12 Dim strAssignmentDate As String
13 Dim strExpectedReturnDate As String
14
15 strUserName = Me.txtUserName.Text
16 strBlackberryNumber = Me.txtBlackberryNumber.Text
17 strAssignmentDate = Me.txtAssignmentDate.Text
18 strExpectedReturnDate = Me.txtExpectedReturnDate.Text
19
20 ' Create an Outlook application.
21 Dim oApp As Outlook.Application = New Outlook.Application()
22
23 ' Create a new AppointmentItem.
24 Dim oAppt As Outlook.AppointmentItem = oApp.CreateItem(Outlook.OlItemType.olAppointmentItem)
25
26 ' Set some common properties.
27 oAppt.Subject = strUserName
28 oAppt.Body = strUserName
29 oAppt.Location = strBlackberryNumber
30
31 oAppt.Start = Convert.ToDateTime(strAssignmentDate)
32 oAppt.End = Convert.ToDateTime(strExpectedReturnDate)
33 oAppt.ReminderSet = True
34 oAppt.ReminderMinutesBeforeStart = 5
35 oAppt.BusyStatus = Outlook.OlBusyStatus.olBusy
36 oAppt.IsOnlineMeeting = False
37
38 ' Save to Calendar.
39 oAppt.Save()
40
41 ' Clean up.
42 oApp = Nothing
43 oAppt = Nothing
44
45 End Sub


Sign In
Create Account


Back to top









