.Find fails for .Outlook._Items

  • Thread starter Thread starter S.Clark
  • Start date Start date
S

S.Clark

[I put this in .general, but was specifically requested to repost here.]

Using VB.NET:

The last line of this code errors out. Any clues?

oApp = New Microsoft.Office.Interop.Outlook.Application()
oNS = oApp.GetNamespace("MAPI")
oNS.Logon(Missing.Value, Missing.Value, True, True)

Dim oCt As Microsoft.Office.Interop.Outlook.ContactItem
Dim objconts As Microsoft.Office.Interop.Outlook._Items = targetFolder.Items

oCt = objconts.Find("[CustomerID]='" & strID & "'")

===

Error Info:
Message = "The operation failed"
ErrorCode = -142589947
 
No Set for VB.NET code.




Jan Hyde (VB MVP) said:
"Jan Hyde (VB MVP)" <[email protected]>'s
wild thoughts were released on Fri, 17 Oct 2008 09:16:23
+0100 bearing the following fruit:
S.Clark <[email protected]>'s wild thoughts
were released on Thu, 16 Oct 2008 12:13:03 -0700 bearing the
following fruit:
[I put this in .general, but was specifically requested to repost here.]

Using VB.NET:

The last line of this code errors out. Any clues?

oApp = New Microsoft.Office.Interop.Outlook.Application()
oNS = oApp.GetNamespace("MAPI")
oNS.Logon(Missing.Value, Missing.Value, True, True)

Dim oCt As Microsoft.Office.Interop.Outlook.ContactItem
Dim objconts As Microsoft.Office.Interop.Outlook._Items =
targetFolder.Items

oCt = objconts.Find("[CustomerID]='" & strID & "'")

Try

oCt = objconts.Find("[CustomerID]= " & Chr$(34) & strID &
Chr$(34))

Oops

Set oCt = etc
 
Your code looks correct. It looks to me like you may have 'Folder Visible'
permissions on the target folder but maybe not 'Read Items'.
 
Back
Top