FolderInfo.EnumerateMessages

EnumerateMessages()

Retrieves MessageInfo objects from the folder.

public IEnumerable<MessageInfo> EnumerateMessages()

Return Value

An enumerable collection of all MessageInfo objects in the folder, excluding folder associated information (FAI) items.

Remarks

Use this method to iterate through all messages in the folder without applying any filters or limits. Folder associated information (FAI) items, such as hidden metadata or configuration items, are not included in the returned collection.

See Also


EnumerateMessages(MailQuery)

Retrieves a collection of MessageInfo objects that match the specified query.

public IEnumerable<MessageInfo> EnumerateMessages(MailQuery mailQuery)
ParameterTypeDescription
mailQueryMailQueryThe query criteria used to filter messages.

Return Value

An enumerable collection of MessageInfo objects matching the query.

Remarks

Use this method to retrieve messages that satisfy specific conditions, such as sender, subject, or date range, as defined by the mailQuery.

See Also


EnumerateMessages(MessageKind)

Retrieves a collection of MessageInfo objects of the specified kind.

public IEnumerable<MessageInfo> EnumerateMessages(MessageKind kind)
ParameterTypeDescription
kindMessageKindThe type of items to retrieve, such as normal messages or folder associated information items.

Return Value

An enumerable collection of MessageInfo objects of the specified kind.

Remarks

Use this method to filter items based on their type, such as distinguishing between messages or Folder Associated Information items.

See Also


EnumerateMessages(int, int)

Retrieves a collection of MessageInfo objects starting from a specific index and limited to a specified count.

public IEnumerable<MessageInfo> EnumerateMessages(int startIndex, int count)
ParameterTypeDescription
startIndexInt32The zero-based index of the first message to retrieve.
countInt32The maximum number of messages to retrieve. If set to -1, retrieves all messages starting from the specified startIndex.

Return Value

An enumerable collection of MessageInfo objects starting at the specified index.

Remarks

Use this method to fetch a subset of messages from the folder, which is useful for paginated retrieval or scenarios requiring controlled message processing. When count is set to -1, all messages from startIndex to the end of the folder are returned.

See Also