Share via


Add Method

Add Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Adds a new BodyPart object to the collection.

Applies To

IBodyParts Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

[Visual Basic]Function Add
(
    ByVal [Index As Long]
) As IBodyPart

[C++]HRESULT Add (     long Index,     IBodyPart** pVal );

Parameters

  • Index
    The ordinal index within the collection at which the new object is to be added. The first element in the collection has an index of 1, and the last element has an index equal to Count. Setting Index to 1 causes the new object to be inserted at the beginning of the collection. Setting Index to -1 causes the new object to be appended to the collection. Index settings of 0 or less than -1 are invalid.
  • pVal
    Returned reference to an IBodyPart Interface.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

Index allows a BodyPart object to be inserted into a specific location in the collection.

If an object already exists in the collection with the index you specify, then that object and all following objects have their index increased by one, and the object is then inserted. Insertion with the Add method does not replace the object at the index you specify.

The content-type for the newly added BodyPart object defaults to "application/octet-stream".

The content-disposition for the newly added BodyPart object defaults to "attachment" if the BodyParts collection contains attachments (that is, it was retrieved using an Attachments property on another object, such as the Message object). The "filename" attribute parameter, however, is not set automatically.

Example

Dim iMsg as New CDO.Message

Dim iBp as IBodyPart Dim iBps as IBodyParts

Set iBps = iMsg.BodyPart.BodyParts Set iBp = iBps.Add ...

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.