• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Folder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createFolder

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
public FolderId createFolder(String folderName, FolderId parentFolderId) throws Exception {
    logger.warn("creating folder '" + folderName + "', sub-directory of '" + parentFolderId + "'");
    Folder failedFolder = new Folder(getService());
    failedFolder.setDisplayName(folderName);
    failedFolder.save(parentFolderId);
    return failedFolder.getId();
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:8,代码来源:EwsFolder.java


示例17: testCreateFolderOperation

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
public boolean testCreateFolderOperation(String folderName) throws Exception {
    FolderId folderId = findFolder(folderName);
    if(folderId == null) {
        logger.debug("folder '"+folderName+"' not found, creating it");
        try {
            Folder failedFolder = new Folder(getService());
            failedFolder.setDisplayName(folderName);
            failedFolder.save(folder.getParentFolderId());
        } catch(Exception e) {
            throw new Exception("could not create folder named '"+folderName+"'",e);
        }
    }
    return true;
}
 
开发者ID:gartcimore,项目名称:javamail4ews,代码行数:15,代码来源:EwsFolder.java


示例18: createPropertyInstance

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
/**
 * Creates the property instance.
 *
 * @param owner The owner.
 * @return ComplexProperty.
 */
@Override public ComplexProperty createPropertyInstance(ServiceObject owner) {
  Folder folder = (Folder) owner;

  EwsUtilities.ewsAssert(folder != null, "PermissionCollectionPropertyDefinition.CreatePropertyInstance",
                         "The owner parameter is not of type Folder or a derived class.");

  return new FolderPermissionCollection(folder);
}
 
开发者ID:OfficeDev,项目名称:ews-java-api,代码行数:15,代码来源:PermissionSetPropertyDefinition.java


示例19: addRangeFolder

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
/**
 * Adds the range.
 *
 * @param folders the folder
 * @throws ServiceLocalException the service local exception
 */
protected void addRangeFolder(Iterable<Folder> folders)
    throws ServiceLocalException {
  if (folders != null) {
    for (Folder folder : folders) {
      this.add(folder);
    }
  }
}
 
开发者ID:OfficeDev,项目名称:ews-java-api,代码行数:15,代码来源:FolderIdWrapperList.java


示例20: createFolder

import microsoft.exchange.webservices.data.core.service.folder.Folder; //导入依赖的package包/类
/**
 * Creates a folder. Calling this method results in a call to EWS.
 *
 * @param folder         The folder.
 * @param parentFolderId The parent folder Id
 * @throws Exception the exception
 */
public void createFolder(Folder folder, FolderId parentFolderId)
    throws Exception {
  CreateFolderRequest request = new CreateFolderRequest(this,
      ServiceErrorHandling.ThrowOnError);
  List<Folder> folArry = new ArrayList<Folder>();
  folArry.add(folder);
  request.setFolders(folArry);
  request.setParentFolderId(parentFolderId);

  request.execute();
}
 
开发者ID:OfficeDev,项目名称:ews-java-api,代码行数:19,代码来源:ExchangeService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DruidRollup类代码示例发布时间:2022-05-22
下一篇:
Java PdfiumCore类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap