当前位置: 首页>>代码示例>>Java>>正文


Java Folder类代码示例

本文整理汇总了Java中microsoft.exchange.webservices.data.core.service.folder.Folder的典型用法代码示例。如果您正苦于以下问题:Java Folder类的具体用法?Java Folder怎么用?Java Folder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Folder类属于microsoft.exchange.webservices.data.core.service.folder包,在下文中一共展示了Folder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exists

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public boolean exists() throws MessagingException {
    if (folder != null) {
        return true;
    }
    try {
        FolderView view = new FolderView(1);
        SearchFilter searchFilter = new SearchFilter.IsEqualTo(FolderSchema.DisplayName, name);
        FindFoldersResults lResult = getService().findFolders(WellKnownFolderName.Inbox, searchFilter, view);
        if (lResult.getTotalCount() > 0) {
            folder = lResult.getFolders().get(0);
            INBOX = Folder.bind(getService(), new FolderId(WellKnownFolderName.Inbox));
            return true;
        } else {
            return false;
        }
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:21,代码来源:EwsFolder.java

示例2: list

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public EwsFolder[] list(String pattern) throws MessagingException {
    FolderView lFolderView = new FolderView(ITEM_VIEW_MAX_ITEMS);
    FindFoldersResults lFindFoldersResults;
    try {
        SearchFilter.SearchFilterCollection lSearchFilter = new SearchFilter.SearchFilterCollection();
        if (!pattern.equals("%")) {
            // TODO incomplete implementation - wildcards are not implemented yet
            lSearchFilter.add(new SearchFilter.IsEqualTo(FolderSchema.DisplayName, pattern));
        }
        lFindFoldersResults = folder.findFolders(lSearchFilter, lFolderView);
        List<Folder> lFolders = lFindFoldersResults.getFolders();

        EwsFolder[] retValue = new EwsFolder[lFolders.size()];
        for (int i = 0; i < retValue.length; i++) {
            retValue[i] = new EwsFolder(getStore(), lFolders.get(i).getId());
        }

        return retValue;
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:24,代码来源:EwsFolder.java

示例3: open

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public void open(int mode) throws MessagingException {
    this.mode = mode;
    try {
        if (!exists()) {
            throw new FolderNotFoundException();
        }
        ItemView view = new ItemView(ITEM_VIEW_MAX_ITEMS);
        folder = Folder.bind(getService(), folder.getId());

        if (prefetchItems) {
            FindItemsResults<Item> lFindResults = getService().findItems(folder.getId(), view);
            messages = new ArrayList<>(lFindResults.getTotalCount());
            unreadMessages = new ArrayList<>();
            for (Item aItem : lFindResults) {
                if (aItem instanceof EmailMessage) {
                    logger.info("Fetching content of item {}", aItem.getId());

                    EmailMessage aEmailMessage = (EmailMessage) aItem;

                    EwsMailConverter aConverter = new EwsMailConverter(this, aEmailMessage, messages.size() + 1);

                    messages.add(aConverter.convert());

                } else {
                    logger.warn("Skipping item {} as it is a {}", aItem.getId(), aItem.getClass());
                }
            }
        } else {

        }
        timestamp = new Date();
        getStore().notifyConnectionListeners(ConnectionEvent.OPENED);
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:38,代码来源:EwsFolder.java

示例4: checkFolderExistsRemotely

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
private boolean checkFolderExistsRemotely() throws MessagingException {
    FolderView folderView = new FolderView(Integer.MAX_VALUE);
    folderView.setTraversal(FolderTraversal.Deep);
    try {
        for (Folder f:
                store.getService().findFolders(store.getRootFolderId(),
                        folderView).getFolders()) {
            if (f.getDisplayName().equals(displayName)) {
                return true;
            }
        }
        return false;
    } catch (Exception e) {
        throw new MessagingException("Unable to check folder existence", e);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:17,代码来源:EwsFolder.java

示例5: EwsFolder

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
private EwsFolder(EwsStore store, FolderId pFolderId, FolderId pParentFolderId) {
    super(store);
    addFolderListener(new FolderListenerPublisher());

    ITEM_VIEW_MAX_ITEMS = getConfiguration().getInt(
            "org.sourceforge.net.javamail4ews.store.EwsFolder.ItemViewMaxItems");
    CONFLICT_RESOLUTION_MODE = ConflictResolutionMode.valueOf(getConfiguration().getString(
            "org.sourceforge.net.javamail4ews.store.EwsFolder.ConflictResolutionMode"));
    DELETE_MODE = DeleteMode.valueOf(getConfiguration().getString(
            "org.sourceforge.net.javamail4ews.store.EwsFolder.DeleteMode"));
    prefetchItems = getConfiguration().getBoolean("org.sourceforge.net.javamail4ews.store.EwsFolder.prefetchItems");
    try {
        INBOX = Folder.bind(getService(), new FolderId(WellKnownFolderName.Inbox));

        if (pFolderId != null) {
            folder = Folder.bind(getService(), pFolderId);
            parentFolder = Folder.bind(getService(), folder.getParentFolderId());
        } else if (pParentFolderId != null) {
            parentFolder = Folder.bind(getService(), pParentFolderId);
        } else {
            throw new IllegalArgumentException("pFolderId and pParentFolderId are null!");
        }
    } catch (Exception e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:27,代码来源:EwsFolder.java

示例6: close

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public void close(boolean expunge) throws MessagingException {
    if (mode == javax.mail.Folder.READ_WRITE) {
        try {
            if (expunge) {
                expunge();
            }
            // Update the messages
            markMessageRead(messages);
            markMessageRead(unreadMessages);
            // and the folder itself
            folder.update();

        } catch (Exception e) {
            // Close anyway
            throw new MessagingException(e.getMessage(), e);
        } finally {
            folder = null;
            getStore().notifyConnectionListeners(ConnectionEvent.CLOSED);
        }
    }
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:23,代码来源:EwsFolder.java

示例7: delete

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public boolean delete(boolean recurse) throws MessagingException {
    if (isOpen()) {
        throw new IllegalStateException("Folder not closed!");
    }
    try {
        if (recurse) {
            for (javax.mail.Folder aFolder : list()) {
                aFolder.delete(recurse);
            }
        } else {
            // Simplest approach
            if (getMessageCount() > 0) {
                return false;
            }
        }

        folder.delete(DELETE_MODE);
        notifyFolderListeners(FolderEvent.DELETED);
        return true;
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:25,代码来源:EwsFolder.java

示例8: renameTo

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public boolean renameTo(javax.mail.Folder f) throws MessagingException {
    if (isOpen()) {
        throw new IllegalStateException("Folder must be closed!");
    }
    FolderId targetFolderId;
    if (f instanceof EwsFolder) {
        targetFolderId = ((EwsFolder) f).folder.getId();
    } else {
        targetFolderId = getFolder(f.getFullName()).folder.getId();
    }
    try {
        folder.move(targetFolderId);
        getStore().notifyFolderListeners(FolderEvent.RENAMED, this);
        return true;
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:20,代码来源:EwsFolder.java

示例9: bindToFolder

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
/**
 * Binds to a folder.
 *
 *
 * @param folderId    the folder id
 * @param propertySet the property set
 * @return Folder
 * @throws Exception the exception
 */
public Folder bindToFolder(FolderId folderId, PropertySet propertySet)
    throws Exception {
  EwsUtilities.validateParam(folderId, "folderId");
  EwsUtilities.validateParam(propertySet, "propertySet");

  GetFolderRequest request = new GetFolderRequest(this,
      ServiceErrorHandling.ThrowOnError);

  request.getFolderIds().add(folderId);
  request.setPropertySet(propertySet);

  ServiceResponseCollection<GetFolderResponse> responses = request
      .execute();

  return responses.getResponseAtIndex(0).getFolder();

}
 
开发者ID:OfficeDev,项目名称:ews-java-api,代码行数:27,代码来源:ExchangeService.java

示例10: readElementsFromXml

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
/**
 * Reads response elements from XML.
 *
 * @param reader The reader.
 * @throws Exception the exception
 */
@Override
protected void readElementsFromXml(EwsServiceXmlReader reader)
    throws Exception {
  super.readElementsFromXml(reader);

  List<Folder> folders;
  try {
    folders = reader.readServiceObjectsCollectionFromXml(

        XmlElementNames.Folders, this, false,/* clearPropertyBag */
        null, /* requestedPropertySet */
        false); /* summaryPropertiesOnly */

    this.folder = folders.get(0);
  } catch (ServiceLocalException e) {
    LOG.error(e);
  }

}
 
开发者ID:OfficeDev,项目名称:ews-java-api,代码行数:26,代码来源:MoveCopyFolderResponse.java

示例11: testGetItemTypeFromXmlElementName

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Test
public void testGetItemTypeFromXmlElementName() {
  assertEquals(Task.class, EwsUtilities.getItemTypeFromXmlElementName("Task"));
  assertEquals(EmailMessage.class, EwsUtilities.getItemTypeFromXmlElementName("Message"));
  assertEquals(PostItem.class, EwsUtilities.getItemTypeFromXmlElementName("PostItem"));
  assertEquals(SearchFolder.class, EwsUtilities.getItemTypeFromXmlElementName("SearchFolder"));
  assertEquals(Conversation.class, EwsUtilities.getItemTypeFromXmlElementName("Conversation"));
  assertEquals(Folder.class, EwsUtilities.getItemTypeFromXmlElementName("Folder"));
  assertEquals(CalendarFolder.class, EwsUtilities.getItemTypeFromXmlElementName("CalendarFolder"));
  assertEquals(MeetingMessage.class, EwsUtilities.getItemTypeFromXmlElementName("MeetingMessage"));
  assertEquals(Contact.class, EwsUtilities.getItemTypeFromXmlElementName("Contact"));
  assertEquals(Item.class, EwsUtilities.getItemTypeFromXmlElementName("Item"));
  assertEquals(Appointment.class, EwsUtilities.getItemTypeFromXmlElementName("CalendarItem"));
  assertEquals(ContactsFolder.class, EwsUtilities.getItemTypeFromXmlElementName("ContactsFolder"));
  assertEquals(MeetingRequest.class, EwsUtilities.getItemTypeFromXmlElementName("MeetingRequest"));
  assertEquals(TasksFolder.class, EwsUtilities.getItemTypeFromXmlElementName("TasksFolder"));
  assertEquals(MeetingCancellation.class, EwsUtilities.getItemTypeFromXmlElementName("MeetingCancellation"));
  assertEquals(MeetingResponse.class, EwsUtilities.getItemTypeFromXmlElementName("MeetingResponse"));
  assertEquals(ContactGroup.class, EwsUtilities.getItemTypeFromXmlElementName("DistributionList"));
}
 
开发者ID:OfficeDev,项目名称:ews-java-api,代码行数:21,代码来源:EwsUtilitiesTest.java

示例12: discoverFolders

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
private void discoverFolders(WellKnownFolderName wellKnownFolderName) throws Exception { // NOSONAR - EWS Java API throws Exception, that's life

        FindFoldersResults folders = exchangeService.findFolders(wellKnownFolderName,
                new FolderView(Integer.MAX_VALUE));

        for (Folder folder : folders.getFolders()) {
            LOG.info("Found folder: " + wellKnownFolderName.name() + " - " + folder.getDisplayName());
        }
    }
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:10,代码来源:ExchangeCalendarProvider.java

示例13: EwsFolder

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
EwsFolder(EwsStore store, Folder folder)
        throws ServiceLocalException {
    this.store = store;
    displayName = folder.getDisplayName();
    folderId = folder.getId();
    parentId = folder.getParentFolderId();
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:8,代码来源:EwsFolder.java

示例14: open

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public void open(int mode) throws MessagingException {
    messageCount = -1;
    try {
        folder = Folder.bind(store.getService(), folderId);
        folder.getUnreadCount();
        parentId = folder.getParentFolderId();
        messageCount = folder.getTotalCount();
    } catch (Exception e) {
        throw new MessagingException("Unable to open folder", e);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:13,代码来源:EwsFolder.java

示例15: create

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
@Override
public boolean create(FolderType type) throws MessagingException {
    try {
        ExchangeService service = store.getService();
        service.createFolder(new Folder(service),
                store.getRootFolderId());
    } catch (Exception e) {
        throw new MessagingException("Unable to create folder", e);
    }
    return true;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:12,代码来源:EwsFolder.java


注:本文中的microsoft.exchange.webservices.data.core.service.folder.Folder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。