for anyones info:
the restriction isnt one at all it is to & my name
Dim i, j As Integer
Dim oApp As Outlook.Application = New Outlook.Application
Dim sClassComp = "IPM.Note" ' String used for comparison with mail item.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI") 'Get mapi namespace
Dim file As System.IO.FileInfo
Dim s As String = "_Unallocated Amex"
' Get Messages collection of Inbox.
Dim oInbox As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderInbox)
Dim oItems As Outlook.Items = oInbox.Folders.Item(s).Items
Dim oAttachment As Outlook.Attachment
Dim oMsg As Outlook.MailItem
oItems = oItems.Restrict("[to]= Michael Kerr")
' Loop each message.
For i = 1 To oItems.Count
'Test to make sure item is a mail item
'and not a meeting request.
If oItems.Item(i).MessageClass = sClassComp Then
oMsg = oItems.Item(i)
For j = 1 To oMsg.Attachments.Count
oAttachment = oMsg.Attachments.Item(i)
Debug.WriteLine(oAttachment.FileName)
Next
End If
Next
' Clean up.
oApp = Nothing
oNS = Nothing
oItems = Nothing
oMsg = Nothing