![]() |
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
|
|||
|
|||
![]()
Hi....
got a problem... Outlook 2003 & Exchange Server 2003 I´d like to iterate through folder Items but it fails with RESULT: 0x80004002 (E_NOINTERFACE) after the 249´s Item each time... ![]() Don´t know what to do.... [code:] Private Sub btnSearchAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchAll.Click Dim myItems As Microsoft.Office.Interop.Outlook.Items = myContactFolder.Items Dim myItem As Outlook.ContactItem For i As Integer = myContactFolder.Items.Count To 1 Step -1 ' Failure HRESULT: 0x80004002 (E_NOINTERFACE) myItem = myItems.Item(i) 'lstSearchResults.Items.Add("skipped " & myItem.FileAs.ToString & " - " & myItem.Categories) If Microsoft.VisualBasic.Information.TypeName(myItem) = "ContactItem" Then If InStr(myItem.Categories, txtSearch.Text, CompareMethod.Text) Then lstSearchResults.Items.Add(myItem.FileAs.ToString & " - " & myItem.Categories) End If Else MsgBox(Microsoft.VisualBasic.Information.TypeName( myItem)) End If If i = 100 Then Stop Next i End Sub [/code:] " Das COM-Objekt des Typs "System.__ComObject" kann nicht in den Schnittstellentyp "Microsoft.Office.Interop.Outlook.ContactItem" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{00063021-0000-0000-C000-000000000046}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)). " I also tried the oÓutlook repair feature... but no changes... Greets from Germany HelixX23 |
#2
|
|||
|
|||
![]()
You are running out of the 255 RPC channels/process imposed by Exchange in
the online mode. 1. Do cache the value of fMAPIFolder.Item 2. Explicitly release the items as soon as you arae done with them: set myItems = myContactFolder.Items For i As Integer = myContactFolder.Items.Count To 1 Step -1 ' set myItem = myItems.Item(i) ... Marshal.ReleaseCOMObject(myItem) GC.Collect(); Next i Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "HelixX23" wrote in message ... Hi.... got a problem... Outlook 2003 & Exchange Server 2003 I´d like to iterate through folder Items but it fails with RESULT: 0x80004002 (E_NOINTERFACE) after the 249´s Item each time... ![]() Don´t know what to do.... [code:] Private Sub btnSearchAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchAll.Click Dim myItems As Microsoft.Office.Interop.Outlook.Items = myContactFolder.Items Dim myItem As Outlook.ContactItem For i As Integer = myContactFolder.Items.Count To 1 Step -1 ' Failure HRESULT: 0x80004002 (E_NOINTERFACE) myItem = myItems.Item(i) 'lstSearchResults.Items.Add("skipped " & myItem.FileAs.ToString & " - " & myItem.Categories) If Microsoft.VisualBasic.Information.TypeName(myItem) = "ContactItem" Then If InStr(myItem.Categories, txtSearch.Text, CompareMethod.Text) Then lstSearchResults.Items.Add(myItem.FileAs.ToString & " - " & myItem.Categories) End If Else MsgBox(Microsoft.VisualBasic.Information.TypeName( myItem)) End If If i = 100 Then Stop Next i End Sub [/code:] " Das COM-Objekt des Typs "System.__ComObject" kann nicht in den Schnittstellentyp "Microsoft.Office.Interop.Outlook.ContactItem" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{00063021-0000-0000-C000-000000000046}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)). " I also tried the oÓutlook repair feature... but no changes... Greets from Germany HelixX23 |
#3
|
|||
|
|||
![]()
Hi... thanks for answering
![]() I tried this: Private Sub SearchALL() Dim myItems As Microsoft.Office.Interop.Outlook.Items = myContactFolder.Items pgbSearchAndReplace.Enabled = True pgbSearchAndReplace.Minimum = 0 pgbSearchAndReplace.Maximum = myItems.Count pgbSearchAndReplace.Value = 0 MsgBox("Items.Count = " & myItems.Count) For i As Integer = 1 To myContactFolder.Items.Count Dim myItem As Outlook.ContactItem = myItems.Item(i) If Microsoft.VisualBasic.Information.TypeName(myItem) = "ContactItem" Then If InStr(myItem.Categories, txtSearch.Text, CompareMethod.Text) Then lstSearchResults.Items.Add(myItem.FileAs.ToString & " - " & myItem.Categories) End If Else MsgBox(Microsoft.VisualBasic.Information.TypeName( myItem)) End If ' Release ComObject Try System.Runtime.InteropServices.Marshal.ReleaseComO bject(myItem) Catch ex As Exception MsgBox("Can't release ComObject" & vbCrLf & ex.Message) End Try myItem = Nothing GC.Collect() GC.WaitForPendingFinalizers() Next i End Sub but it fails the same at Item 249 it seems that myItem does not release itself... what am i doing wrong? Greets HelixX23 "Dmitry Streblechenko" wrote: You are running out of the 255 RPC channels/process imposed by Exchange in the online mode. 1. Do cache the value of fMAPIFolder.Item 2. Explicitly release the items as soon as you arae done with them: set myItems = myContactFolder.Items For i As Integer = myContactFolder.Items.Count To 1 Step -1 ' set myItem = myItems.Item(i) ... Marshal.ReleaseCOMObject(myItem) GC.Collect(); Next i Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "HelixX23" wrote in message ... Hi.... got a problem... Outlook 2003 & Exchange Server 2003 I´d like to iterate through folder Items but it fails with RESULT: 0x80004002 (E_NOINTERFACE) after the 249´s Item each time... ![]() Don´t know what to do.... [code:] Private Sub btnSearchAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchAll.Click Dim myItems As Microsoft.Office.Interop.Outlook.Items = myContactFolder.Items Dim myItem As Outlook.ContactItem For i As Integer = myContactFolder.Items.Count To 1 Step -1 ' Failure HRESULT: 0x80004002 (E_NOINTERFACE) myItem = myItems.Item(i) 'lstSearchResults.Items.Add("skipped " & myItem.FileAs.ToString & " - " & myItem.Categories) If Microsoft.VisualBasic.Information.TypeName(myItem) = "ContactItem" Then If InStr(myItem.Categories, txtSearch.Text, CompareMethod.Text) Then lstSearchResults.Items.Add(myItem.FileAs.ToString & " - " & myItem.Categories) End If Else MsgBox(Microsoft.VisualBasic.Information.TypeName( myItem)) End If If i = 100 Then Stop Next i End Sub [/code:] " Das COM-Objekt des Typs "System.__ComObject" kann nicht in den Schnittstellentyp "Microsoft.Office.Interop.Outlook.ContactItem" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{00063021-0000-0000-C000-000000000046}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)). " I also tried the oÓutlook repair feature... but no changes... Greets from Germany HelixX23 |
#4
|
|||
|
|||
![]()
Maybe GC does not feel to release my objects...
"4. GC will release the COM objects whenever it feels like it, which may be minutes later. And COM subsystem does not handle "all of that", GC and the object itself do. " "When GC feels it is time to release it (whenever that might be)," What can i do to force him to release myItem? "HelixX23" wrote: Hi... thanks for answering ![]() I tried this: Private Sub SearchALL() Dim myItems As Microsoft.Office.Interop.Outlook.Items = myContactFolder.Items pgbSearchAndReplace.Enabled = True pgbSearchAndReplace.Minimum = 0 pgbSearchAndReplace.Maximum = myItems.Count pgbSearchAndReplace.Value = 0 MsgBox("Items.Count = " & myItems.Count) For i As Integer = 1 To myContactFolder.Items.Count Dim myItem As Outlook.ContactItem = myItems.Item(i) If Microsoft.VisualBasic.Information.TypeName(myItem) = "ContactItem" Then If InStr(myItem.Categories, txtSearch.Text, CompareMethod.Text) Then lstSearchResults.Items.Add(myItem.FileAs.ToString & " - " & myItem.Categories) End If Else MsgBox(Microsoft.VisualBasic.Information.TypeName( myItem)) End If ' Release ComObject Try System.Runtime.InteropServices.Marshal.ReleaseComO bject(myItem) Catch ex As Exception MsgBox("Can't release ComObject" & vbCrLf & ex.Message) End Try myItem = Nothing GC.Collect() GC.WaitForPendingFinalizers() Next i End Sub but it fails the same at Item 249 it seems that myItem does not release itself... what am i doing wrong? Greets HelixX23 "Dmitry Streblechenko" wrote: You are running out of the 255 RPC channels/process imposed by Exchange in the online mode. 1. Do cache the value of fMAPIFolder.Item 2. Explicitly release the items as soon as you arae done with them: set myItems = myContactFolder.Items For i As Integer = myContactFolder.Items.Count To 1 Step -1 ' set myItem = myItems.Item(i) ... Marshal.ReleaseCOMObject(myItem) GC.Collect(); Next i Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "HelixX23" wrote in message ... Hi.... got a problem... Outlook 2003 & Exchange Server 2003 I´d like to iterate through folder Items but it fails with RESULT: 0x80004002 (E_NOINTERFACE) after the 249´s Item each time... ![]() Don´t know what to do.... [code:] Private Sub btnSearchAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchAll.Click Dim myItems As Microsoft.Office.Interop.Outlook.Items = myContactFolder.Items Dim myItem As Outlook.ContactItem For i As Integer = myContactFolder.Items.Count To 1 Step -1 ' Failure HRESULT: 0x80004002 (E_NOINTERFACE) myItem = myItems.Item(i) 'lstSearchResults.Items.Add("skipped " & myItem.FileAs.ToString & " - " & myItem.Categories) If Microsoft.VisualBasic.Information.TypeName(myItem) = "ContactItem" Then If InStr(myItem.Categories, txtSearch.Text, CompareMethod.Text) Then lstSearchResults.Items.Add(myItem.FileAs.ToString & " - " & myItem.Categories) End If Else MsgBox(Microsoft.VisualBasic.Information.TypeName( myItem)) End If If i = 100 Then Stop Next i End Sub [/code:] " Das COM-Objekt des Typs "System.__ComObject" kann nicht in den Schnittstellentyp "Microsoft.Office.Interop.Outlook.ContactItem" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{00063021-0000-0000-C000-000000000046}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)). " I also tried the oÓutlook repair feature... but no changes... Greets from Germany HelixX23 |
#5
|
|||
|
|||
![]()
Marshal.ReleaseComObject(myItem);
// followed by GC.Collect(); GC.WaitForPendingFinalizers(); -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "HelixX23" wrote in message ... Maybe GC does not feel to release my objects... "4. GC will release the COM objects whenever it feels like it, which may be minutes later. And COM subsystem does not handle "all of that", GC and the object itself do. " "When GC feels it is time to release it (whenever that might be)," What can i do to force him to release myItem? |
#6
|
|||
|
|||
![]()
In my Environment Marshal is not defined
I´m using Visual Studio 2005 VBA Outlook Addin to get this working.. So i used the System.Runtime.InteropServices.Marshal.ReleaseComO bject referenced function to release my COM Object... but.. it does not work.. Code:
For i As Integer = 1 To myContactFolder.Items.Count Debug.Print("generate Object") Debug.Print("Speicher: " & GC.GetTotalMemory(True)) Dim myItem As Outlook.ContactItem = myContactFolder.Items.Item(i) ' here drops the failure when "i" reaches "249 as int" Debug.Print("Speicher: " & GC.GetTotalMemory(True)) If Microsoft.VisualBasic.Information.TypeName(myItem) = "ContactItem" Then If InStr(myItem.Categories, txtSearch.Text, CompareMethod.Text) Then lstSearchResults.Items.Add(myItem.FileAs.ToString & " - " & myItem.Categories) End If Else Debug.Print(Microsoft.VisualBasic.Information.TypeName(myItem)) End If ' Try to Release ComObject Try System.Runtime.InteropServices.Marshal.ReleaseComObject(myItem) Catch ex As Exception Debug.Print("Can't release ComObject" & vbCrLf & ex.Message) End Try myItem = Nothing If i Mod 245 = 0 Then ' --- GC starten GC.Collect() GC.WaitForPendingFinalizers() End If Next i "Ken Slovak - [MVP - Outlook]" wrote: Marshal.ReleaseComObject(myItem); // followed by GC.Collect(); GC.WaitForPendingFinalizers(); -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "HelixX23" wrote in message ... Maybe GC does not feel to release my objects... "4. GC will release the COM objects whenever it feels like it, which may be minutes later. And COM subsystem does not handle "all of that", GC and the object itself do. " "When GC feels it is time to release it (whenever that might be)," What can i do to force him to release myItem? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Operation aborted (Exception from HRESULT: 0x80004004) | Kulvinder | Add-ins for Outlook | 3 | November 27th 07 12:42 PM |
Problem using Myitem.UserProperties.Find("string") | John E. | Outlook and VBA | 3 | January 3rd 07 04:12 PM |
how to retain 10 days items in Outlook 2003 deleted items folder? | Balthazar | Outlook - Installation | 2 | June 7th 06 04:05 PM |
Exception from HRESULT | Laks | Add-ins for Outlook | 1 | May 11th 06 09:24 AM |
Inbox, Sent Items & Outbox in Deleted Items in Outlook 2003 & OWA with Exchange | splounx | Outlook - General Queries | 1 | February 17th 06 02:22 AM |