Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / February 2005

Tip: Looking for answers? Try searching our database.

How to flush outlooks open connection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sam Jost - 28 Dec 2004 14:53 GMT
Is there a way to flush outlooks cache?

I'm adding a lot of contacts in a public folder, then I want to close
outlook, but flush its write cache or whatever it is first.

Using olNamespace.logoff and olApp.Quit does not flush these caches. Is
there any other command I am missing?

Thanks,
Sam
Ken Slovak - 28 Dec 2004 23:15 GMT
What language, what version of Outlook, are you using Exchange?

Flushing the cache is not available but if you are closing Outlook then the
cache should be flushed by that action, assuming that Outlook isn't hung in
memory.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Is there a way to flush outlooks cache?
>
[quoted text clipped - 6 lines]
> Thanks,
> Sam
Sam Jost - 29 Dec 2004 09:45 GMT
Hi Again :)

Using c#, Outlook 2003 and Exchange 2003 (SBS 2003) for the public folder.

Closing Outlook (namespace.Logoff() and outlook.Quit()) and opening it anew
does not flush the cache for me.

The exact source I'd been using to flush was:
--
outlookNamespace.Logoff();
outlookApp.Quit();
outlookApp = new Outlook.Application();
outlookNamespace = outlookApp.GetNamespace("mapi");
outlookNamespace.Logon("", "", true, true);
outlookKontaktFolder = outlookNamespace.GetFolderFromID( FolderEntryID,
StoreEntryID);
--

and it did not flush the cache, the objects are still pending on this new
instance of Outlook.

Sam

> What language, what version of Outlook, are you using Exchange?
>
[quoted text clipped - 12 lines]
>> Thanks,
>> Sam
Ken Slovak - 29 Dec 2004 14:06 GMT
You seem to have solved it based on your other thread but always remember to
explicitly release all your objects and calling the garbage collector.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Hi Again :)
>
[quoted text clipped - 35 lines]
>>> Thanks,
>>> Sam
Sam Jost - 29 Dec 2004 15:14 GMT
I thought so, too, but it turned out that closing outlook did not flush
these things.

So  I'm still looking for some way to flush outlooks caches, to make it sync
completely and close I'd guess?

Or some other way to read and import lots of data to Exchange public
folders, thats what I need the flush for.

Can maybe Exchange (2003) itself be called/scripted from c# on the server?

Sam

"Ken Slovak" <kenslovak@mvps.org> write:
> You seem to have solved it based on your other thread but always remember
> to explicitly release all your objects and calling the garbage collector.
[quoted text clipped - 39 lines]
>>>> Thanks,
>>>> Sam
Ken Slovak - 29 Dec 2004 18:44 GMT
As I recall it's a timing issue if you don't explicitly release all your
objects. I think Exchange just holds open those RPC connection channels for
a considerable time. But since I refuse to code Outlook in VB.NET or C# I'm
not positive.

The language isn't so much the issue as the API you use. You can connect to
an Exchange server using lots of different API's, some of which are
supported for C#, such as WebDAV or ADO or CDO 1.21 or Extended MAPI and so
on. I don't think you can close those RPC channels that are affecting your
code using any programmatic access as far as I know though.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

>I thought so, too, but it turned out that closing outlook did not flush
>these things.
[quoted text clipped - 8 lines]
>
> Sam
Sam Jost - 30 Dec 2004 11:41 GMT
Hi Ken,

yep, you are right, the problem does appear when not releasing my objects,
and some timeout takes care of it after a looong time.

Well, anyway, problem is solved now, thanks a lot again!
Sam

> As I recall it's a timing issue if you don't explicitly release all your
> objects. I think Exchange just holds open those RPC connection channels
[quoted text clipped - 20 lines]
>>
>> Sam
Rich Barone - 08 Feb 2005 16:59 GMT
Here's an example: (ns is your already obtained namespace)

       Dim objSycs As Outlook.SyncObjects
       Dim objSyc As Outlook.SyncObject
       Dim fldContacts As Outlook.MAPIFolder
       Dim fldNotes As Outlook.MAPIFolder

       Try
           objSycs = ns.SyncObjects
           objSyc = objSycs.AppFolders
               fldContacts =
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
               fldContacts.InAppFolderSyncObject = True
               fldNotes =
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderNotes)
               fldNotes.InAppFolderSyncObject = True
           objSyc.Start()

> Hi Ken,
>
[quoted text clipped - 28 lines]
> >>
> >> Sam
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.