![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I can't figure out why the CDO session is hanging on Logoff for the
following code. I've read about the bug he http://support.microsoft.com/?kbid=177630 I've tried many different variations but the results are the same. It was running fine using the Outlook object model but I wanted to Delete without dumping into my Deleted items or moving it to the journal box deleted items and emptying it afterwards so I added the CDO bit. I've obviously changed the params for the DN of the exchange server for this post. I'm running Outlook 2003 sp2 with Exchange 2003 sp2. Does it make any difference that I'm opening the Journal mailbox in addition to my mailbox? It hangs if I skip logoff and set objCDOSession=Nothing too. Sub ClearInbox_Journal() On Error GoTo ClearInbox_Error Dim objItem As MailItem, objItems As Outlook.Items Dim objItemsRestrict As Outlook.Items Dim objInboxFolder As Outlook.MAPIFolder Dim objDeletedFolder As Outlook.MAPIFolder Dim objCDO As MAPI.Message Dim objCDOSession As MAPI.Session Dim sEntryID As String Dim sStoreID As String Dim objNS As Outlook.NameSpace Dim x As Long, i As Long, dCurrent As Date Dim dDateFilter As Date, sServerDName As String dCurrent = Now() dDateFilter = DateAdd("d", -3, dCurrent) sServerDName = "/o=MYORG/ou=MYOU/cn=Configuration/cn=Servers/cn=MYSERVER" Set objNS = Application.GetNamespace("MAPI") Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon "", "", False, False, , True, sServerDName & vbLf & vbLf & "anon" Set objInboxFolder = objNS.Folders("Mailbox - Journal").Folders("Inbox") 'Set objDeletedFolder = objNS.Folders("Mailbox - Journal").Folders("Deleted Items") Set objItems = objInboxFolder.Items objItems.Sort "[ReceivedTime]", True Set objItemsRestrict = objItems.Restrict("[ReceivedTime] '" & Format(dDateFilter, "ddddd h:nn AMPM") & "'") For x = objItemsRestrict.Count To 1 Step -1 DoEvents Set objItem = objItemsRestrict.item(x) If Not objItem Is Nothing Then sEntryID = objItem.EntryID sStoreID = objItem.Parent.StoreID Set objCDO = objCDOSession.GetMessage(sEntryID, sStoreID) If Not objCDO Is Nothing Then objCDO.Delete End If End If Next objCDOSession.Logoff Set objCDOSession = Nothing Set objItem = Nothing Set objItems = Nothing Set objCDO = Nothing Set objInboxFolder = Nothing Set objNS = Nothing On Error GoTo 0 Exit Sub ClearInbox_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure " & _ "ClearInbox_Journal" End Sub TIA Matt |
Ads |
#2
|
|||
|
|||
![]()
Most likely you still live MAPI objects used by CDO object at the time when
you call Logoff. Does it owkr if you only have calls to Logon and Logoff with nothign in between? Try to to all CDO handling code into a separate sub: Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon... DoCDOStuff(objCDOSession) objCDOSession.Logoff This way all implecit variables (such as thouse created when yo uuse multiple dot notation) will be released when the DoCDOStuff sub above exits. -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Matt Williamson" wrote in message ... I can't figure out why the CDO session is hanging on Logoff for the following code. I've read about the bug he http://support.microsoft.com/?kbid=177630 I've tried many different variations but the results are the same. It was running fine using the Outlook object model but I wanted to Delete without dumping into my Deleted items or moving it to the journal box deleted items and emptying it afterwards so I added the CDO bit. I've obviously changed the params for the DN of the exchange server for this post. I'm running Outlook 2003 sp2 with Exchange 2003 sp2. Does it make any difference that I'm opening the Journal mailbox in addition to my mailbox? It hangs if I skip logoff and set objCDOSession=Nothing too. Sub ClearInbox_Journal() On Error GoTo ClearInbox_Error Dim objItem As MailItem, objItems As Outlook.Items Dim objItemsRestrict As Outlook.Items Dim objInboxFolder As Outlook.MAPIFolder Dim objDeletedFolder As Outlook.MAPIFolder Dim objCDO As MAPI.Message Dim objCDOSession As MAPI.Session Dim sEntryID As String Dim sStoreID As String Dim objNS As Outlook.NameSpace Dim x As Long, i As Long, dCurrent As Date Dim dDateFilter As Date, sServerDName As String dCurrent = Now() dDateFilter = DateAdd("d", -3, dCurrent) sServerDName = "/o=MYORG/ou=MYOU/cn=Configuration/cn=Servers/cn=MYSERVER" Set objNS = Application.GetNamespace("MAPI") Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon "", "", False, False, , True, sServerDName & vbLf & vbLf & "anon" Set objInboxFolder = objNS.Folders("Mailbox - Journal").Folders("Inbox") 'Set objDeletedFolder = objNS.Folders("Mailbox - Journal").Folders("Deleted Items") Set objItems = objInboxFolder.Items objItems.Sort "[ReceivedTime]", True Set objItemsRestrict = objItems.Restrict("[ReceivedTime] '" & Format(dDateFilter, "ddddd h:nn AMPM") & "'") For x = objItemsRestrict.Count To 1 Step -1 DoEvents Set objItem = objItemsRestrict.item(x) If Not objItem Is Nothing Then sEntryID = objItem.EntryID sStoreID = objItem.Parent.StoreID Set objCDO = objCDOSession.GetMessage(sEntryID, sStoreID) If Not objCDO Is Nothing Then objCDO.Delete End If End If Next objCDOSession.Logoff Set objCDOSession = Nothing Set objItem = Nothing Set objItems = Nothing Set objCDO = Nothing Set objInboxFolder = Nothing Set objNS = Nothing On Error GoTo 0 Exit Sub ClearInbox_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure " & _ "ClearInbox_Journal" End Sub TIA Matt |
#3
|
|||
|
|||
![]() Most likely you still live MAPI objects used by CDO object at the time when you call Logoff. Does it owkr if you only have calls to Logon and Logoff with nothign in between? Try to to all CDO handling code into a separate sub: Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon... DoCDOStuff(objCDOSession) objCDOSession.Logoff This way all implecit variables (such as thouse created when yo uuse multiple dot notation) will be released when the DoCDOStuff sub above exits. Thanks for the reply Dmitry I tested it by calling Logon and then Logoff immediately following it. It still hangs. Here is my test Sub TestCDO() Dim objCDOSession As Mapi.Session Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon "", "", True, False 'objCDOSession.Logon "", "", True, True objCDOSession.Logoff Set objCDOSession = Nothing End Sub I also disabled all Add-ins and Com Add-ins and while Outlook loads a while lot faster, it hasn't alleviated the hang. Is there anything else you can think of? TIA Matt |
#4
|
|||
|
|||
![]()
Does it hang if yu log to a profile that only has a PST store?
-- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Matt Williamson" wrote in message ... Most likely you still live MAPI objects used by CDO object at the time when you call Logoff. Does it owkr if you only have calls to Logon and Logoff with nothign in between? Try to to all CDO handling code into a separate sub: Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon... DoCDOStuff(objCDOSession) objCDOSession.Logoff This way all implecit variables (such as thouse created when yo uuse multiple dot notation) will be released when the DoCDOStuff sub above exits. Thanks for the reply Dmitry I tested it by calling Logon and then Logoff immediately following it. It still hangs. Here is my test Sub TestCDO() Dim objCDOSession As Mapi.Session Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon "", "", True, False 'objCDOSession.Logon "", "", True, True objCDOSession.Logoff Set objCDOSession = Nothing End Sub I also disabled all Add-ins and Com Add-ins and while Outlook loads a while lot faster, it hasn't alleviated the hang. Is there anything else you can think of? TIA Matt |
#5
|
|||
|
|||
![]()
It doesn't appear to. I created a Test profile that connected to an exchange
server but set message delivery to goto a PST and I can close Outlook and the process doesn't remain in memory. The issue is with Outlook when connecting to my exchange server it just manifested itself when I was running the CDO code to the point that I noticed it. I've been troubleshooting that issue now and I can't figure out what the problem is. It happens in windows safe mode with network so I know is isn't any external programs and it happens in Outlook safe mode so I know it isn't any add-ins. Any ideas for troubleshooting further? When I open Outlook and then close it, the process stays in memory and spikes the CPU to 60-100% until I kill the Outlook.exe process manually. Process monitor shows it checking some reg keys for TCP/IP bindings over and over again with buffer overflows. 18366 3:40:13.5232138 PM OUTLOOK.EXE 2176 RegQueryValue HKLM\System\CurrentControlSet\Services\Tcpip\Linka ge\Bind BUFFER OVERFLOW Length: 144 18367 3:40:13.5232317 PM OUTLOOK.EXE 2176 RegQueryValue HKLM\System\CurrentControlSet\Services\Tcpip\Linka ge\Bind BUFFER OVERFLOW Length: 144 18368 3:40:13.5232423 PM OUTLOOK.EXE 2176 RegQueryValue HKLM\System\CurrentControlSet\Services\Tcpip\Linka ge\Bind SUCCESS Type: REG_MULTI_SZ, Length: 696, Data: \Device\{D9C56594-9151-4432-A52C-2A43D46EC9B2}, \Device\{CEFEBC60-BDFA-4121-997C-14F072DF3ED2}, \Device\{270FC095-6FFC-4FBE-AD6B-054BC5EAA214}, \Device\{D91A66EB-BDEF-4860-ADC3-82E7B655E826}, \Device\{A2C8446B-32FC-47DB-B0BF-24A22DE03A27}, \Device\NdisWanIp, \Device\{A969B0F2-1D88-4AB3-9B6E-1E68E73B0595}, \Device\{A83FB030-DE63-4506-88A2-F3E37B737055} 18369 3:40:13.5233781 PM OUTLOOK.EXE 2176 RegQueryValue HKLM\System\CurrentControlSet\Services\Tcpip\Linka ge\Bind BUFFER OVERFLOW Length: 144 18370 3:40:13.5233890 PM OUTLOOK.EXE 2176 RegQueryValue HKLM\System\CurrentControlSet\Services\Tcpip\Linka ge\Bind BUFFER OVERFLOW Length: 144 18371 3:40:13.5233985 PM OUTLOOK.EXE 2176 RegQueryValue HKLM\System\CurrentControlSet\Services\Tcpip\Linka ge\Bind SUCCESS Type: REG_MULTI_SZ, Length: 696, Data: \Device\{D9C56594-9151-4432-A52C-2A43D46EC9B2}, \Device\{CEFEBC60-BDFA-4121-997C-14F072DF3ED2}, \Device\{270FC095-6FFC-4FBE-AD6B-054BC5EAA214}, \Device\{D91A66EB-BDEF-4860-ADC3-82E7B655E826}, \Device\{A2C8446B-32FC-47DB-B0BF-24A22DE03A27}, \Device\NdisWanIp, \Device\{A969B0F2-1D88-4AB3-9B6E-1E68E73B0595}, \Device\{A83FB030-DE63-4506-88A2-F3E37B737055} "Dmitry Streblechenko" wrote in message ... Does it hang if yu log to a profile that only has a PST store? -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Matt Williamson" wrote in message ... Most likely you still live MAPI objects used by CDO object at the time when you call Logoff. Does it owkr if you only have calls to Logon and Logoff with nothign in between? Try to to all CDO handling code into a separate sub: Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon... DoCDOStuff(objCDOSession) objCDOSession.Logoff This way all implecit variables (such as thouse created when yo uuse multiple dot notation) will be released when the DoCDOStuff sub above exits. Thanks for the reply Dmitry I tested it by calling Logon and then Logoff immediately following it. It still hangs. Here is my test Sub TestCDO() Dim objCDOSession As Mapi.Session Set objCDOSession = CreateObject("MAPI.Session") objCDOSession.Logon "", "", True, False 'objCDOSession.Logon "", "", True, True objCDOSession.Logoff Set objCDOSession = Nothing End Sub I also disabled all Add-ins and Com Add-ins and while Outlook loads a while lot faster, it hasn't alleviated the hang. Is there anything else you can think of? TIA Matt |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Detect logoff/shutdown | j | Add-ins for Outlook | 1 | July 21st 09 03:42 PM |
Outlook hanging | Eva | Outlook - Installation | 3 | August 20th 08 08:57 PM |
Outlook hanging | Gene | Outlook - Installation | 0 | October 2nd 07 04:41 PM |
Outlook hanging | John | Outlook - Installation | 2 | May 17th 07 10:34 PM |
to all with OE hanging | [email protected] | Outlook Express | 0 | September 3rd 06 05:26 AM |