/**************************************************************************
* copyright file="ExchangeService.java" company="Microsoft"
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* Defines the ExchangeService.java.
**************************************************************************/
package microsoft.exchange.webservices.data;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.FutureTask;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
/**
* Represents a binding to the Exchange Web Services.
*/
public final class ExchangeService extends ExchangeServiceBase implements
IAutodiscoverRedirectionUrl {
/** The url. */
private URI url;
/** The preferred culture. */
private Locale preferredCulture;
/** The DateTimePrecision */
private DateTimePrecision dateTimePrecision = DateTimePrecision.Default;
/** The impersonated user id. */
private ImpersonatedUserId impersonatedUserId;
// private Iterator<ItemId> Iterator;
/** The file attachment content handler. */
private IFileAttachmentContentHandler fileAttachmentContentHandler;
/** The unified messaging. */
private UnifiedMessaging unifiedMessaging;
// private boolean exchange2007CompatibilityMode;
private boolean enableScpLookup = true;
private boolean exchange2007CompatibilityMode;
/**
* Create response object.
*
* @param responseObject
* the response object
* @param parentFolderId
* the parent folder id
* @param messageDisposition
* the message disposition
* @return The list of items created or modified as a result of the
* "creation" of the response object.
* @throws Exception
* the exception
*/
protected List<Item> internalCreateResponseObject(
ServiceObject responseObject, FolderId parentFolderId,
MessageDisposition messageDisposition) throws Exception {
CreateResponseObjectRequest request = new CreateResponseObjectRequest(
this, ServiceErrorHandling.ThrowOnError);
Collection<ServiceObject> serviceList = new ArrayList();
serviceList.add(responseObject);
request.setParentFolderId(parentFolderId);
request.setItems(serviceList);
request.setMessageDisposition(messageDisposition);
ServiceResponseCollection<CreateResponseObjectResponse> responses = request
.execute();
return responses.getResponseAtIndex(0).getItems();
}
/**
* 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
*/
protected 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();
}
/**
* Updates a folder.
*
* @param folder
* The folder.
* @throws Exception
* the exception
*/
protected void updateFolder(Folder folder) throws Exception {
UpdateFolderRequest request = new UpdateFolderRequest(this,
ServiceErrorHandling.ThrowOnError);
request.getFolders().add(folder);
request.execute();
}
/**
* Copies a folder. Calling this method results in a call to EWS.
*
* @param folderId
* The folderId.
* @param destinationFolderId
* The destination folder id.
* @return the folder
* @throws Exception
* the exception
*/
protected Folder copyFolder(FolderId folderId, FolderId destinationFolderId)
throws Exception {
CopyFolderRequest request = new CopyFolderRequest(this,
ServiceErrorHandling.ThrowOnError);
request.setDestinationFolderId(destinationFolderId);
request.getFolderIds().add(folderId);
ServiceResponseCollection<MoveCopyFolderResponse> responses = request
.execute();
return responses.getResponseAtIndex(0).getFolder();
}
/**
* Move a folder.
*
* @param folderId
* The folderId.
* @param destinationFolderId
* The destination folder id.
* @return the folder
* @throws Exception
* the exception
*/
protected Folder moveFolder(FolderId folderId, FolderId destinationFolderId)
throws Exception {
MoveFolderRequest request = new MoveFolderRequest(this,
ServiceErrorHandling.ThrowOnError);
request.setDestinationFolderId(destinationFolderId);
request.getFolderIds().add(folderId);
ServiceResponseCollection<MoveCopyFolderResponse> responses = request
.execute();
return responses.getResponseAtIndex(0).getFolder();
}
/**
* Finds folders.
*
* @param parentFolderIds
* The parent folder ids.
* @param searchFilter
* The search filter. Available search filter classes include
* SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and
* SearchFilter.SearchFilterCollection
* @param view
* The view controlling the number of folders returned.
* @param errorHandlingMode
* Indicates the type of error handling should be done.
* @return Collection of service responses.
* @throws Exception
* the exception
*/
private ServiceResponseCollection<FindFolderResponse> internalFindFolders(
Iterable<FolderId> parentFolderIds, SearchFilter searchFilter,
FolderView view, ServiceErrorHandling errorHandlingMode)
throws Exception {
FindFolderRequest request = new FindFolderRequest(this,
errorHandlingMode);
request.getParentFolderIds().addRangeFolderId(parentFolderIds);
request.setSearchFilter(searchFilter);
request.setView(view);
return request.execute();
}
/**
* Obtains a list of folders by searching the sub-folders of the specified
* folder.
*
* @param parentFolderId
* The Id of the folder in which to search for folders.
* @param searchFilter
* The search filter. Available search filter classes include
* SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and
* SearchFilter.SearchFilterCollection
* @param view
* The view controlling the number of folders returned.
* @return An object representing the results of the search operation.
* @throws Exception
* the exception
*/
public FindFoldersResults findFolders(FolderId parentFolderId,
SearchFilter searchFilter, FolderView view) throws Exception {
EwsUtilities.validateParam(parentFolderId, "parentFolderId");
EwsUtilities.validateParam(view, "view");
EwsUtilities.validateParamAllowNull(searchFilter, "searchFilter");
List<FolderId> folderIdArray = new ArrayList<FolderId>();
folderIdArray.add(parentFolderId);
ServiceResponseCollection<FindFolderResponse> responses = this
.internalFindFolders(folderIdArray, searchFilter, view,
ServiceErrorHandling.ThrowOnError);
return responses.getResponseAtIndex(0).getResults();
}
/**
* Obtains a list of folders by searching the sub-folders of the specified
* folder.
*
* @param parentFolderId
* The Id of the folder in which to search for folders.
* @param view
* The view controlling the number of folders returned.
* @return An object representing the results of the search operation.
* @throws Exception
* the exception
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JAVA使用EWS发送Exchange Mail 实例 (595个子文件)
jcifs-1.3.17.jar 387KB
commons-httpclient-3.1.jar 298KB
apache-commons-codec-1.4.jar 61KB
commons-logging-1.1.3.jar 61KB
ExchangeService.java 151KB
XmlElementNames.java 96KB
AutodiscoverService.java 74KB
EwsUtilities.java 51KB
ServiceError.java 49KB
Appointment.java 42KB
SearchFilter.java 42KB
Recurrence.java 39KB
Item.java 37KB
ContactSchema.java 35KB
ExchangeServiceBase.java 32KB
EwsXmlReader.java 31KB
ServiceRequestBase.java 31KB
Contact.java 30KB
RulePredicates.java 29KB
PropertyBag.java 28KB
Conversation.java 28KB
Strings.java 28KB
OutlookProtocol.java 26KB
FolderPermission.java 26KB
Folder.java 25KB
ConversationSchema.java 25KB
UserConfigurationDictionary.java 25KB
AppointmentSchema.java 24KB
AutodiscoverRequest.java 24KB
MeetingRequest.java 23KB
UserConfiguration.java 20KB
ItemSchema.java 19KB
EmailMessage.java 19KB
PropertySet.java 18KB
EwsServiceXmlWriter.java 18KB
ServiceObject.java 17KB
Task.java 17KB
StreamingSubscriptionConnection.java 17KB
RuleProperty.java 15KB
RuleActions.java 15KB
GroupMemberCollection.java 14KB
AttachmentCollection.java 14KB
MapiTypeConverter.java 14KB
ServiceObjectInfo.java 13KB
ComplexPropertyCollection.java 13KB
HttpClientWebRequest.java 13KB
ServiceObjectSchema.java 13KB
TimeSpan.java 12KB
ExtendedPropertyDefinition.java 12KB
HangingServiceRequestBase.java 12KB
TaskSchema.java 12KB
HttpWebRequest.java 12KB
TimeZoneDefinition.java 11KB
EmailMessageSchema.java 11KB
TimeZoneTransitionGroup.java 11KB
DelegatePermissions.java 11KB
ComplexProperty.java 11KB
AvailabilityOptions.java 10KB
PhysicalAddressEntry.java 10KB
ServiceResponse.java 10KB
PostItem.java 10KB
Attachment.java 10KB
SoapFaultDetails.java 10KB
ConversationAction.java 10KB
EmailAddress.java 10KB
MeetingRequestSchema.java 10KB
DictionaryProperty.java 9KB
StringList.java 9KB
MapiTypeConverterMapEntry.java 9KB
GetUserSettingsRequest.java 9KB
GroupMember.java 9KB
ExtendedPropertyCollection.java 9KB
WSSecurityBasedCredentials.java 8KB
FileAttachment.java 8KB
OutlookConfigurationSettings.java 8KB
ResolveNamesRequest.java 8KB
GetUserSettingsResponse.java 8KB
LegacyAvailabilityTimeZoneTime.java 8KB
XMLNodeType.java 8KB
GetUserAvailabilityRequest.java 7KB
UserSettingName.java 7KB
EwsJCIFSNTLMScheme.java 7KB
UpdateItemRequest.java 7KB
SyncFolderItemsRequest.java 7KB
XmlAttributeNames.java 7KB
EwsServiceXmlReader.java 7KB
Rule.java 7KB
OofSettings.java 7KB
PropertyDefinition.java 7KB
EwsSSLProtocolSocketFactory.java 7KB
PostReply.java 7KB
GetDomainSettingsRequest.java 7KB
TimeZoneTransition.java 7KB
GetEventsResults.java 6KB
ExtendedProperty.java 6KB
ItemAttachment.java 6KB
FolderId.java 6KB
OrderByCollection.java 6KB
SimpleServiceRequestBase.java 6KB
TimeChange.java 6KB
共 595 条
- 1
- 2
- 3
- 4
- 5
- 6
fangfangyun
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页