473,770 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 =
ThisOutlookSess ion.GetNamespac e("MAPI").GetDe faultFolder(olF olderInbox).ite m
s
For Each item In items
If item.Class = olMail Then
Set mi = item
Set subfolder =
ThisOutlookSess ion.GetNamespac e("MAPI").GetDe faultFolder(olF olderInbox) _
.Folders(mi.Sen derName)
If subfolder Is Nothing Then

ThisOutlookSess ion.GetNamespac e("MAPI").GetDe faultFolder(olF olderInbox) _
.Folders.Add (mi.SenderName)
Set subfolder =
Application.Get Namespace("MAPI ").GetDefaultFo lder(olFolderIn box) _
.Folders(mi.Sen derName)
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.Safe MailItem
sm.Item = item
MessageBox.Show (sm.SenderName)
subfolder = Me.m_olNamespac e.GetFolderFrom ID(sm.SenderNam e)
If subfolder Is Nothing Then
Me.m_olNamespac e.GetDefaultFol der(OlDefaultFo lders.olFolderI nbox).Folders.A d
d(sm.SenderName )
End If
CType(item, MailItem).Move( subfolder)
Catch ex As System.Exceptio n
End Try
End If
Next
Catch ex As SystemException
DebugWriter("Cl eanInbox Exception: {0}", ex.Message)
End Try
Nov 20 '05 #1
4 5995
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_oladdinvbne t.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.co m> wrote in message
news:eZ******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP10.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 =
ThisOutlookSess ion.GetNamespac e("MAPI").GetDe faultFolder(olF olderInbox).ite m s
For Each item In items
If item.Class = olMail Then
Set mi = item
Set subfolder =
ThisOutlookSess ion.GetNamespac e("MAPI").GetDe faultFolder(olF olderInbox) _
.Folders(mi.Sen derName)
If subfolder Is Nothing Then

ThisOutlookSess ion.GetNamespac e("MAPI").GetDe faultFolder(olF olderInbox) _
.Folders.Add (mi.SenderName)
Set subfolder =
Application.Get Namespace("MAPI ").GetDefaultFo lder(olFolderIn box) _
.Folders(mi.Sen derName)
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.Safe MailItem
sm.Item = item
MessageBox.Show (sm.SenderName)
subfolder = Me.m_olNamespac e.GetFolderFrom ID(sm.SenderNam e)
If subfolder Is Nothing Then
Me.m_olNamespac e.GetDefaultFol der(OlDefaultFo lders.olFolderI nbox).Folders.A d d(sm.SenderName )
End If
CType(item, MailItem).Move( subfolder)
Catch ex As System.Exceptio n
End Try
End If
Next
Catch ex As SystemException
DebugWriter("Cl eanInbox 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_oladdinvbne t.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\o ul3\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_olNamespac e.GetDefaultFol der(OlDefaultFo lders.olFolderI nbox).Items

"Fergus Cooney" <fi****@post.co m> wrote in message
news:eZ******** ******@TK2MSFTN GP10.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
7385
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 Outlook.Application SentFld =
1
3760
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 = DirectCast(objOutlook.CreateItem(Outlook.OlItemType.olJournalItem), Outlook.JournalItem) objJournalEntry.Subject = "TEST!" objNameSpace = objOutlook.GetNamespace("MAPI")
5
3651
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 address, I want to open a new mail message to that person. I don't want to send the message, just open a new blank email so that I can make it easier to send messages. Any idea how I could find out more about how to do this ?
7
3628
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 get to item 250 i get a "system.invalid cast exception" and "specified cast is not valid". Once i get this error and try to go to the next record.. every record after gets the same error... It's like the com connection to outlook has been lost....
2
1817
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 many issues in case of Web application. Code: Outlook.Application app = new Outlook.Application();
5
3328
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 time-periods that the rooms are booked for that day. I know how to code all this in Access. I can show some testdata for 5 rooms quite nicely on a form. I never ever needed to use Outlook-to-Access before, so I need a good starting point to get the data.
2
7303
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 "Array index out of bounds". Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass(); Microsoft.Office.Interop.Outlook._NameSpace olNs = olApp.GetNamespace("MAPI");
7
6811
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 Inbox As Outlook.MAPIFolder Dim InboxItems As Outlook.Items Dim Mailobject As Object Set OlApp = CreateObject("Outlook.Application")
11
7738
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 enabled me to the contacts at least list. I had to root around to discover CdoDefaultFolderContacts (though it was guessable; how could I enumerate win32com.client.constants?). I now want to work through the Contacts in Outlook patching in...
1
4678
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 As New Outlook.Application Dim objNS As Outlook.NameSpace Dim objRecip As Outlook.Recipient Dim objFolder As Outlook.MAPIFolder objNS = objolApp.GetNamespace("MAPI")
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.