use of com.microsoft.schemas.exchange.services._2006.messages.GetFolderResponseType in project zm-mailbox by Zimbra.
the class ExchangeEWSFreeBusyProvider method bindFolder.
BaseFolderType bindFolder(DistinguishedFolderIdNameType distinguishedFolderId, DefaultShapeNamesType shapeType) {
final DistinguishedFolderIdType distinguishedFolderIdType = new DistinguishedFolderIdType();
distinguishedFolderIdType.setId(distinguishedFolderId);
final NonEmptyArrayOfBaseFolderIdsType nonEmptyArrayOfBaseFolderIdsType = new NonEmptyArrayOfBaseFolderIdsType();
nonEmptyArrayOfBaseFolderIdsType.getFolderIdOrDistinguishedFolderId().add(distinguishedFolderIdType);
GetFolderType getFolderRequest = new GetFolderType();
getFolderRequest.setFolderIds(nonEmptyArrayOfBaseFolderIdsType);
FolderResponseShapeType stResp = new FolderResponseShapeType();
stResp.setBaseShape(shapeType);
getFolderRequest.setFolderShape(stResp);
RequestServerVersion serverVersion = new RequestServerVersion();
serverVersion.setVersion(ExchangeVersionType.EXCHANGE_2010_SP_1);
Holder<ServerVersionInfo> gfversionInfo = new Holder<ServerVersionInfo>();
Holder<GetFolderResponseType> gfresponseHolder = new Holder<GetFolderResponseType>();
MailboxCultureType mct = new MailboxCultureType();
mct.setValue("EN");
TimeZoneDefinitionType tzdt = new TimeZoneDefinitionType();
tzdt.setId("Greenwich Standard Time");
TimeZoneContextType tzct = new TimeZoneContextType();
tzct.setTimeZoneDefinition(tzdt);
ManagementRoleType role = null;
service.getFolder(getFolderRequest, mct, serverVersion, tzct, role, gfresponseHolder, gfversionInfo);
FolderInfoResponseMessageType firmtResp = (FolderInfoResponseMessageType) gfresponseHolder.value.getResponseMessages().getCreateItemResponseMessageOrDeleteItemResponseMessageOrGetItemResponseMessage().get(0).getValue();
if (firmtResp.getFolders().getFolderOrCalendarFolderOrContactsFolder().size() > 0) {
return firmtResp.getFolders().getFolderOrCalendarFolderOrContactsFolder().get(0);
} else {
ZimbraLog.fb.error("Could not find the folder in Exchange : " + distinguishedFolderId.toString());
}
return null;
}
Aggregations