Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Interop / January 2005

Tip: Looking for answers? Try searching our database.

Attachment Collection Problem !!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
W Akthar - 06 Jan 2005 11:42 GMT
I have a problem trying to iterate through the Attachment
Collection.
Even when the count of Attachments is greater than 0 I
still get an error message as follows.

Error: Index (zero based) must be greater than or equal
to zero and less than the size of the argument list.
I have included the code below.

int i = 1;                   
foreach (Outlook.Attachment att in oMail.Attachments)
{                        
    SqlCommand cmAttachmentCommand = new SqlCommand
("SP_Add_Outlook_Email_Attachments", sqlConn);
                                  
    cmAttachmentCommand.CommandType =
CommandType.StoredProcedure;
                       
    // Add Parameters to SPROC
                           
    cmAttachmentCommand.Parameters.Add(new
SqlParameter("@MailAttachmentID", attachmentID));
                           
    cmAttachmentCommand.Parameters.Add(new
SqlParameter("@MailAttachmentNumber", i));
                           
    cmAttachmentCommand.Parameters.Add(new
SqlParameter("@MailAttachmentType", 1));
       
    // ## ERROR OCCURS HERE !!!!!           
    cmAttachmentCommand.Parameters.Add(new
SqlParameter("@BlobField", att));

                           
    // Open the connection and execute the Command
                           
    cmAttachmentCommand.ExecuteNonQuery();
                           
    i++;
}
W Akthar - 06 Jan 2005 15:14 GMT
Problem solved !!

>-----Original Message-----
>I have a problem trying to iterate through the Attachment
[quoted text clipped - 38 lines]
>}
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.