N
Nathan Carroll
Why am I able to use this in Outlook and not do the same from .Net.
My problems centers around the Items in the xp version of below i used the
interop references. Does something similar exist for 2000?
'this works fine in ol 2000
Dim item As Object
Dim items As Outlook.items
Dim itemcount As Integer
Dim subfolder As MAPIFolder
Dim mi As MailItem
On Error Resume Next
Set items =
ThisOutlookSession.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).item
s
For Each item In items
If item.Class = olMail Then
Set mi = item
Set subfolder =
ThisOutlookSession.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
If subfolder Is Nothing Then
ThisOutlookSession.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders.Add (mi.SenderName)
Set subfolder =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
End If
mi.Move subfolder
End If
Next
previously this had worked with an outlook xp reference following the com
example on msdn from micoreye
but I am trying to implement the addin with Outlook 2000
VB.net:
'works with the interop dlls but not when I use 9.0
Try
Dim item As Object
For Each item In Inbox
If TypeOf item Is MailItem Then
Try
Dim subfolder As MAPIFolder
Dim sm As Redemption.SafeMailItem
sm.Item = item
MessageBox.Show(sm.SenderName)
subfolder = Me.m_olNamespace.GetFolderFromID(sm.SenderName)
If subfolder Is Nothing Then
Me.m_olNamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Folders.Ad
d(sm.SenderName)
End If
CType(item, MailItem).Move(subfolder)
Catch ex As System.Exception
End Try
End If
Next
Catch ex As SystemException
DebugWriter("CleanInbox Exception: {0}", ex.Message)
End Try
My problems centers around the Items in the xp version of below i used the
interop references. Does something similar exist for 2000?
'this works fine in ol 2000
Dim item As Object
Dim items As Outlook.items
Dim itemcount As Integer
Dim subfolder As MAPIFolder
Dim mi As MailItem
On Error Resume Next
Set items =
ThisOutlookSession.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).item
s
For Each item In items
If item.Class = olMail Then
Set mi = item
Set subfolder =
ThisOutlookSession.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
If subfolder Is Nothing Then
ThisOutlookSession.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders.Add (mi.SenderName)
Set subfolder =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) _
.Folders(mi.SenderName)
End If
mi.Move subfolder
End If
Next
previously this had worked with an outlook xp reference following the com
example on msdn from micoreye
but I am trying to implement the addin with Outlook 2000
VB.net:
'works with the interop dlls but not when I use 9.0
Try
Dim item As Object
For Each item In Inbox
If TypeOf item Is MailItem Then
Try
Dim subfolder As MAPIFolder
Dim sm As Redemption.SafeMailItem
sm.Item = item
MessageBox.Show(sm.SenderName)
subfolder = Me.m_olNamespace.GetFolderFromID(sm.SenderName)
If subfolder Is Nothing Then
Me.m_olNamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Folders.Ad
d(sm.SenderName)
End If
CType(item, MailItem).Move(subfolder)
Catch ex As System.Exception
End Try
End If
Next
Catch ex As SystemException
DebugWriter("CleanInbox Exception: {0}", ex.Message)
End Try