/** @param newName */ public void renameFolder(String newName) throws Exception { Folder fOld = getFolder(); Folder fNew = handler.getStore().getFolder(profile.getFolderNameSpace() + newName); closeFolder(fOld); fOld.renameTo(fNew); fNew.setSubscribed(true); }
protected void renameMailbox( final Properties props, final String folderName, final String user, final String password) throws MessagingException { final Store store = Session.getInstance(props).getStore(); store.connect(user, password); checkStoreForTestConnection(store); final Folder f = store.getFolder(folderName); f.renameTo(store.getFolder("renamed_from_" + folderName)); logger.info("Renamed " + f.getFullName()); store.close(); }