Hey,
i have written this code to read all Outlook Appointments from another user and fill them into my DGV. -
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
-
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
1 4676
I found a solution :)
After i went through every Item i do this: -
If objRecip.Resolved Then
-
objFolder = objNS.GetSharedDefaultFolder(objRecip, Outlook.OlDefaultFolders.olFolderCalendar)
-
-
For x As Integer = 1 To objFolder.Items.Count
-
-
'Same code as above...
-
-
End If
-
-
'Quit the Session when every item is added.
-
-
objolApp.Quit()
-
-
'Run garbagecollector
-
-
GC.Collect()
-
GC.WaitForPendingFinalizers()
-
GC.Collect()
-
GC.WaitForPendingFinalizers()
-
Next
-
End If
-
Simple, huh? :)
Sorry for my bad english.
Greetings from Germany. :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Martin Knauer |
last post by:
Hi,
I try to build an Outlook Plugin. After having some trouble with the
Inspectorevents I'm trying to build a wrapper for the Inspectorclass.
However I'm stuck again after letting VS.Net 2003 create the stubs for the
Inspector-Interface.
When I try to compile the new Wrapperclass it says
|
by: John |
last post by:
Hi
I am using the following code to search for an email message with id myID;
Dim SentFld As Outlook.MAPIFolder
Dim Email As Outlook.MailItem
Dim I As Integer
OutlookApp = New Outlook.Application
SentFld =
|
by: George McCullen |
last post by:
I have an Outlook 2003 using Exchange Server 2003 Public Contacts Folder containing 20,000 Contacts. I am writing a VB .Net 2003 program that loops through all the contacts in a "for each oCt in oItems" loop. After about 250 contacts, the program gives an InvalidCastException Error on the for each loop. I notice that Outlook's memory keeps increasing (using the task manager) until it reaches around 20,000K. When I run the program a second...
|
by: David Anderson |
last post by:
Does anyone know how to drag&drop a message with attachments from Outlook
(2002 or 2003) in to a VB.Net windows form.
This is really stumping me. I've spent a fair amount of time trying to find
a solution on the internet, with limited success.
I do have code to drag an attachment directly from Outlook to a form, but
not a whole message.
I want to have access to an object reprensenting the message so I can bust
out the message and...
|
by: Li Pang |
last post by:
Hi,
I used following codes to pass a message item from CDO to Outlook. They
worked fine when I used outlook 2000, but get an error of "Specified cast is
not valid." when I used Outlook 2003. Anybody has an ideal?
Dim outlookMsg AsMicrosoft.Office.Interop.Outlook.MailItem
Dim adoMsg As MAPI.Message
outlookMsg =
Microsoft.Office.Interop.Outlook.Application.Session.GetItemFromID(cdoMsg.ID)
| |
by: Snig |
last post by:
Hi
I'm into creating a web application in C# (.NET Framework 1.1) which
would list and manage the outlook tasks.
If I try to do this in a Windows Application, it works fine. But there
are many issues in case of Web application.
Code:
Outlook.Application app = new Outlook.Application();
|
by: Tom Becker |
last post by:
Is there a way, from Access, to programmatically click the Send and
Receive button in Outlook?
|
by: =?Utf-8?B?QWxleGFuZGVyIEtvbW1lcg==?= |
last post by:
Hi,
I´m developing a feature in a application with the following specification:
In the first step, the application should be able to store messages out of
outlook, which are dropped on a tree view. This message should be stored as
..msg file.
In future, this should be able for alle objects of outlook.
If a drop a message out of outlook, I can get the file name of the message
|
by: pkn6 |
last post by:
Hi All,
I am using VB.net to send my mails through outlook. Where i am giving the resource path for the pictures inserted in to it.
But Email shows the inline pictures as attachments. what could be the reason?
The important thing is that this is not happening all the time. if we send 5 to 10 times we get the expected result for 2 or 3 times.
i explored some of the forums , got answers like 'changing the settings, security settings of the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |