Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Interoperability
Bulletproof Exiting Outlook (and not crashing)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Derek Hart, post: 13752488"] OK, narrowing it down - this routine does properly exit Outlook every time, UNTIL the For Next loop is put in. I added code to try to release objItem. I took a guess that releasing objItem and setting it to nothing, would release Outlook, but it does not. So how do I properly release the item? Without being able to do that, Outlook cannot exit properly. At that point, all should be well. Dim objNameSpace As Outlook.NameSpace Dim objFolder As Outlook.MAPIFolder Dim iterations As Integer Try InstantiateOutlook() objNameSpace = objOutlook.GetNamespace("MAPI") objFolder = objNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox) objNameSpace.Logon() For Each objItem As Outlook.MailItem In objFolder.Items iterations += 1 Marshal.ReleaseComObject(objItem) objItem = Nothing If iterations = 50 Then Exit For Next Marshal.ReleaseComObject(objFolder) Marshal.ReleaseComObject(objNameSpace) objOutlook.Quit() Marshal.ReleaseComObject(objOutlook) objOutlook = Nothing [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Interoperability
Bulletproof Exiting Outlook (and not crashing)
Top