EwsRenameOrMoveFolder Method |
Namespace: MailBee.EwsMail
public bool RenameOrMoveFolder( string folderOldFullName, string folderNewFullName, List<EwsFolder> allFolders )
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | folderOldFullName denotes non-existing folder or folderNewFullName denotes the path with non-existing parent folder or folderNewFullName folder already exists and ThrowExceptions is true. |
MailBeeException | An error occurred and ThrowExceptions is true. |
NotImplementedException | The .NET runtime is .NET Core. |
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".
Note |
---|
This method is not implemented in .NET Core. Use RenameOrMoveFolderAsync(String, String, ListEwsFolder) instead. |