Catalyst Internet Mail .NET

InternetMail.RenameMailbox Method 

Change the name of a mailbox.

[Visual Basic]
Public Function RenameMailbox( _
   ByVal oldMailbox As String, _
   ByVal newMailbox As String _
) As Boolean
[C#]
public bool RenameMailbox(
   string oldMailbox,
   string newMailbox
);

Parameters

oldMailbox
A string that specifies the name of the mailbox to be renamed on the server. The mailbox must exist on the server, otherwise an error will be returned.
newMailbox
A string that specifies the new name for the mailbox. An error will be returned if a mailbox with that name already exists.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

If the existing mailbox name contains inferior hierarchical names (mailboxes under the specified mailbox) then those mailboxes will also be renamed. For example, if the mailbox "Mail/Pictures" contains two mailboxes, "Personal" and "Work" and it is renamed to "Mail/Images" then the two mailboxes under it would be automatically renamed to "Mail/Images/Personal" and "Mail/Images/Work".

If the mailbox being renamed is the currently selected mailbox, the current mailbox will be unselected and any messages marked for deletion will be expunged. The new mailbox name will then automatically be re-selected. To prevent deleted messages from being removed from the mailbox prior to being renamed, use the UnselectMailbox method to unselect the current mailbox before calling RenameMailbox. Note that if the rename operation fails, the client may be left in an unselected state.

It is permitted to rename the special mailbox INBOX. In this case, the messages will be moved from the INBOX mailbox to the new mailbox. If the INBOX mailbox is currently selected, the new mailbox will not automatically be selected. INBOX will remain the selected mailbox.

See Also

InternetMail Class | SocketTools Namespace