By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,952 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,952 IT Pros & Developers. It's quick & easy.

Outlook items

P: n/a
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").GetDefault Folder(olFolderInbox).item
s
For Each item In items
If item.Class = olMail Then
Set mi = item
Set subfolder =
ThisOutlookSession.GetNamespace("MAPI").GetDefault Folder(olFolderInbox) _
.Folders(mi.SenderName)
If subfolder Is Nothing Then

ThisOutlookSession.GetNamespace("MAPI").GetDefault Folder(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
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Nathan,

Could you say a bit more about what the issue is? - I don't know what I'm
looking for.

Regards,
Fergus
Nov 20 '05 #2

P: n/a
Fergus,
I'm trying to incorporate this
http://msdn.microsoft.com/library/de...us/dnout2k2/ht
ml/odc_oladdinvbnet.asp but in a project that adds into a 2000 outlook. At
home I am able to get the com to work using the example link and even do the
things that I want to do with it ( My home machine software matches the
article). Now at work we have Outlook 2000; thus the interop reference to
outlook and office will not work. So I replaced them with MSO9.DLL and
msoutl9.olb. When I did that I found that this line came up with a task
error

"Fergus Cooney" <fi****@post.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
Hi Nathan,

Could you say a bit more about what the issue is? - I don't know what I'm looking for.

Regards,
Fergus

Nov 20 '05 #3

P: n/a
Nathan,
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 There is a discussion of how to 'fix' the Outlook 2000 interop assembly at:

http://www.microeye.com/resources/res_outlookvsnet.htm

See the section titled "Rebuilding the Outlook Interop Assembly"

Hope this helps
Jay

"Nathan Carroll" <th************@Bhutan.com> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl... 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").GetDefault Folder(olFolderInbox).item s
For Each item In items
If item.Class = olMail Then
Set mi = item
Set subfolder =
ThisOutlookSession.GetNamespace("MAPI").GetDefault Folder(olFolderInbox) _
.Folders(mi.SenderName)
If subfolder Is Nothing Then

ThisOutlookSession.GetNamespace("MAPI").GetDefault Folder(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

Nov 20 '05 #4

P: n/a
disregard previous.
Fergus,
I'm trying to incorporate this
http://msdn.microsoft.com/library/de...us/dnout2k2/ht
ml/odc_oladdinvbnet.asp but in a project that adds into a 2000 outlook. At
home I am able to get the com to work using the example link and even do the
things that I want to do with it ( My home machine software matches the
article). Now at work we have Outlook 2000; thus the interop reference to
outlook and office will not work. So I replaced them with MSO9.DLL and
msoutl9.olb. When I did that I found that this line came up with a task
error
C:\VSProjects\oul3\OutAddIn.vb(172): Expression is of type 'Outlook.Items',
which is not a collection type.
from the line:

For Each item In Inbox
from :
'no problem on this one
Me.Inbox =
Me.m_olNamespace.GetDefaultFolder(OlDefaultFolders .olFolderInbox).Items

"Fergus Cooney" <fi****@post.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
Hi Nathan,

Could you say a bit more about what the issue is? - I don't know what I'm looking for.

Regards,
Fergus

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.