EwsRenameOrMoveFolder Method
Renames or moves a folder denoted by its full name rather than by ID.

Namespace: MailBee.EwsMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool RenameOrMoveFolder(
	string folderOldFullName,
	string folderNewFullName,
	List<EwsFolder> allFolders
)

Parameters

folderOldFullName
Type: SystemString
The full name of the folder to rename or move. Null reference (Nothing in Visual Basic) or empty string not allowed.
folderNewFullName
Type: SystemString
The full name the folder should get upon moving/renaming. Null reference or empty string not allowed.
allFolders
Type: System.Collections.GenericListEwsFolder
The list of all folders in the account. You can leave it a null reference but MailBee will have to make a few additional network queries to locate the given folders in the Exchange account.

Return Value

Type: Boolean
true if succeeded; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionfolderOldFullName denotes non-existing folder or folderNewFullName denotes the path with non-existing parent folder or folderNewFullName folder already exists and ThrowExceptions is true.
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

To delimit levels of hierarchy in folder names, use the same character which is set by FolderLevelDelimiter property. By default, it's '/' (forward slash).

allFolders parameter serves optimization purpose only. EWS does not support working with full folder names so MailBee emulates this by finding folders in the MS Exchange account. So, when you need to do something with a folder denoted by its full name, MailBee needs the list of all the folders where it can find the actual item. Usually, you can let MailBee find the folders needed (if allFolders is not set). In advanced cases (if you want to optimize performance) you can supply the list of folders yourself (for instance, you may get it with DownloadFolders(Boolean) method). In this case, allFolders list must include all the folders in the account. Otherwise, you may get MailBeeInvalidArgumentException.

Also, folderNewFullName must denote a folder within an existing parent folder (or in the account root). This method cannot create multiple levels of folder hierarchy at once. I.e. EWS will fail if you specified folderNewFullName as "A/B/C" but there is no "A/B" folder already in the account. First, you need to create "A" and then "A/B".

See Also