SocketTools .NET Edition

MailMessage.FindAttachment Method 

Search for a specific file attachment in the current message.

[Visual Basic]
Public Function FindAttachment( _
   ByVal fileName As String _
) As Integer
[C#]
public int FindAttachment(
   string fileName
);

Parameters

fileName
A string value that specifies the name of the file attachment to search for. This parameter should only specify a base file name; it should not include a file path and cannot be an empty string.

Return Value

An integer value which specifies the message part number that contains the file attachment with a matching name. If the message does not contain a file attachment with the specified name, this method will return -1.

Remarks

The FindAttachment method will search the current message for a attachment that matches the specified file name. The search is not case-sensitive, however it must match the attachment file name completely. This method will not match partial file names or names that include wildcard characters.

See Also