473,385 Members | 1,757 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,385 software developers and data experts.

Outlook object model

I am switching some code from using a reference to Outlook 10 to Outlook
11, but it is breaking some code where I was referring to an inbox items
collection and trying to get at an individual item from the inbox -
since it says that 'Microsoft.Office.Interop.Outlook does not contain a
a definition for item'. Can anybody help?

private void MoveMail(Items col, MAPIFolder destfolder, SqlConnection
objConn, int intInvalidItem)
{
string strInsertQuery = "";

for (int i = 1; i < col.Count + 1; i++)
{

if (col.Item(i) is Outlook.MailItem)
{
MailItem oMsg = (MailItem)col.Item(i);

.....etc

*** Sent via Developersdex http://www.developersdex.com ***
May 16 '07 #1
2 1475
Most likely this has to do with indexers. Try changing:

if (col.Item(i) is Outlook.MailItem)

to:

if (col[i] is Outlook.MailItem)
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Mike P" wrote:
I am switching some code from using a reference to Outlook 10 to Outlook
11, but it is breaking some code where I was referring to an inbox items
collection and trying to get at an individual item from the inbox -
since it says that 'Microsoft.Office.Interop.Outlook does not contain a
a definition for item'. Can anybody help?

private void MoveMail(Items col, MAPIFolder destfolder, SqlConnection
objConn, int intInvalidItem)
{
string strInsertQuery = "";

for (int i = 1; i < col.Count + 1; i++)
{

if (col.Item(i) is Outlook.MailItem)
{
MailItem oMsg = (MailItem)col.Item(i);

.....etc

*** Sent via Developersdex http://www.developersdex.com ***
May 16 '07 #2
Switching from

if (col.Item(i) is Outlook.MailItem)

to

if (col[i] is Outlook.MailItem)

doesn't work, because it doesn't recognise anything as an
Outlook.MailItem. Can anybody help me out here?
*** Sent via Developersdex http://www.developersdex.com ***
May 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Deepak Bhatia | last post by:
Hello Friends I wrote a simple VB application using Outlook Object Model. This application is used t send mail via MS Outlook. I wrote following code on Send button: Set mailitem =...
3
by: Chuck Farah | last post by:
I am unsuccessfullly trying to display an outlook email from a vb web forms (.net) outlook 2002 #1. is it possible to use outlook client email from a web form using the outlook object model...
3
by: Kurt | last post by:
Hi We are developing an off-the-shelf software suite for a certain business sector. Most of the program is simply a GUI on top of some .mdb files. Its a .net application written in c# One...
7
by: MLH | last post by:
Is the following remotely correct? =DDE("C:\Program Files\Program Files\Outlook Express\OEmig50","Attachment","Name") I'm not sure that OEmig50.exe is the executable for OE. Anybody know? ...
6
by: LEBRUN Thomas | last post by:
Hello :) I would like to use Outlook 2003 in my application so for that, i've added the referece to Outlook 11.0 Object Model to my project. Then, I try this simple code : using System;...
2
by: James | last post by:
Is it possible for me to generate Outlook objects in an ASP.NET application on a web server (like a calander event for example) and then attach that object to an email so that the recipient can...
9
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
2
by: Pieter | last post by:
Hi, I'm using a thight integration with Outlook 2003 (with an Exchange server) in my VB.NET (2005) application. Until now I'm using the Outlook Object Model, but it appears to be very slow, and...
2
by: =?Utf-8?B?QWxleGFuZGVyIEtvbW1lcg==?= | last post by:
Hi, I´m developing a feature in a application with the following specification: In the first step, the application should be able to store messages out of outlook, which are dropped on a tree...
5
by: fniles | last post by:
I am using VB.NET 2005. I created a project using the Microsoft Outlook 8.0 Object Library (Object Model) in my previous machine. Now that I have a new machine, when I try to compile that program...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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
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,...
0
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...

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.