473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Outlook items

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
4 5985
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: John | last post by:
Hi I am using the following code to search for an email message with id myID; Dim SentFld As Outlook.MAPIFolder Dim Email As Outlook.MailItem Dim I As Integer OutlookApp = New...
1
by: elziko | last post by:
Everytime I use this code: Dim objOutlook As New Outlook.Application Dim objNameSpace As Outlook.NameSpace Dim objFolder As Outlook.MAPIFolder Dim objJournalEntry As Outlook.JournalItem =...
5
by: TM | last post by:
I would like to write a little app in Visual Basic .net as an add-in to Outlook 2003 so that I can quickly get a list of contact names and email addresses, then when I click on a name or email...
7
by: Chris Thunell | last post by:
I'm trying to loop through an exchange public folder contact list, get some information out of each item, and then put it into a vb.net datatable. I run though the code and all works fine until i...
2
by: Snig | last post by:
Hi I'm into creating a web application in C# (.NET Framework 1.1) which would list and manage the outlook tasks. If I try to do this in a Windows Application, it works fine. But there are...
5
by: Arno R | last post by:
Hi all, I need to get at specific (shared) agenda-data from MS outlook 2003. I need every day to get the scheduled 'appointments' for some rooms to Access. In Access I will show the...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
7
by: Dean Spencer | last post by:
Can anyone help? I am importing Emails from Outlook using the following code: Public Function ScanInbox(SubjectLine As String) Dim TempRst As Recordset Dim OlApp As Outlook.Application Dim...
11
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which...
1
by: chrisli | last post by:
Hey, i have written this code to read all Outlook Appointments from another user and fill them into my DGV. Public Sub ReadOtherUserAppointment(ByVal UserName As String) Dim objolApp...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.