Hey,
i have written this code to read all Outlook Appointments from another user and fill them into my DGV.
Now when i read the appointments and fill them into my DataGridView there is an Error after some items:
System.Runtime. InteropServices .COMException (0x80040305): Your server administrator has limited the number of items you can open simultaneously. ..
I tried objFolder.Items .Item(x).Close( Outlook.OlInspe ctorClose.olDis card), but this gievs me the error:
System.Runtime. InteropServices .COMException (0x8002000F) Parameter not optional...
Any ideas?
Greetings
i have written this code to read all Outlook Appointments from another user and fill them into my DGV.
Code:
Public Sub ReadOtherUserAppointment(ByVal UserName As String)
Dim objolApp As New Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objRecip As Outlook.Recipient
Dim objFolder As Outlook.MAPIFolder
objNS = objolApp.GetNamespace("MAPI")
objRecip = objNS.CreateRecipient(UserName)
objRecip.Resolve()
Dim i As Integer = 0
If objRecip.Resolved Then
objFolder = objNS.GetSharedDefaultFolder(objRecip, Outlook.OlDefaultFolders.olFolderCalendar)
For x As Integer = 1 To objFolder.Items.Count
If objFolder.Items.Item(x).categories = "Urlaub" Then
dgv.Rows.Add()
dgv.Item("clmstart", i).Value = objFolder.Items.Item(x).start
dgv.Item("clmend", i).Value = objFolder.Items.Item(x).end
dgv.Item("clmsubject", i).Value = objFolder.Items.Item(x).subject
dgv.Item("clmcategory", i).Value = objFolder.Items.Item(x).categories
i = i + 1
End If
objFolder.Items.Item(x).Close(Outlook.OlInspectorClose.olDiscard)
Next
End If
System.Runtime. InteropServices .COMException (0x80040305): Your server administrator has limited the number of items you can open simultaneously. ..
I tried objFolder.Items .Item(x).Close( Outlook.OlInspe ctorClose.olDis card), but this gievs me the error:
System.Runtime. InteropServices .COMException (0x8002000F) Parameter not optional...
Any ideas?
Greetings
Comment