Skip to content

Commit

Permalink
#48 GetHoldOnMailboxes complete
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamsi committed Nov 8, 2016
1 parent a546093 commit 4d25181
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 57 deletions.
27 changes: 22 additions & 5 deletions src/js/Core/ExchangeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ import { GetEventsResults } from "../Notifications/GetEventsResults";
import { GetFolderRequest } from "./Requests/GetFolderRequest";
import { GetFolderRequestForLoad } from "./Requests/GetFolderRequestForLoad";
import { GetFolderResponse } from "./Responses/GetFolderResponse";
import { GetHoldOnMailboxesRequest } from "./Requests/GetHoldOnMailboxesRequest";
import { GetHoldOnMailboxesResponse } from "./Responses/GetHoldOnMailboxesResponse";
import { GetInboxRulesRequest } from "./Requests/GetInboxRulesRequest";
import { GetInboxRulesResponse } from "./Responses/GetInboxRulesResponse";
import { GetItemRequest } from "./Requests/GetItemRequest";
Expand All @@ -107,12 +109,12 @@ import { GetItemResponse } from "./Responses/GetItemResponse";
import { GetPasswordExpirationDateRequest } from "./Requests/GetPasswordExpirationDateRequest";
import { GetRoomListsRequest } from "./Requests/GetRoomListsRequest";
import { GetRoomsRequest } from "./Requests/GetRoomsRequest";
import { GetSearchableMailboxesRequest } from './Requests/GetSearchableMailboxesRequest';
import { GetSearchableMailboxesRequest } from "./Requests/GetSearchableMailboxesRequest";
import { GetSearchableMailboxesResponse } from "./Responses/GetSearchableMailboxesResponse";
import { GetUserAvailabilityRequest } from "./Requests/GetUserAvailabilityRequest";
import { GetUserAvailabilityResults } from "../Misc/Availability/GetUserAvailabilityResults";
import { GetUserConfigurationRequest } from "./Requests/GetUserConfigurationRequest";
import { GetUserConfigurationResponse } from './Responses/GetUserConfigurationResponse';
import { GetUserConfigurationResponse } from "./Responses/GetUserConfigurationResponse";
import { GetUserOofSettingsRequest } from "./Requests/GetUserOofSettingsRequest";
import { GetUserRetentionPolicyTagsRequest } from "./Requests/GetUserRetentionPolicyTagsRequest";
import { GetUserRetentionPolicyTagsResponse } from "./Responses/GetUserRetentionPolicyTagsResponse";
Expand Down Expand Up @@ -145,7 +147,7 @@ import { NameResolutionCollection } from "../Misc/NameResolutionCollection";
import { OofSettings } from "../ComplexProperties/Availability/OofSettings";
import { PrivilegedUserId } from "../Misc/PrivilegedUserId";
import { PromiseFactory } from "../PromiseFactory";
import { PropertyDefinitionBase } from '../PropertyDefinitions/PropertyDefinitionBase';
import { PropertyDefinitionBase } from "../PropertyDefinitions/PropertyDefinitionBase";
import { PropertySet } from "./PropertySet";
import { PullSubscription } from "../Notifications/PullSubscription";
import { PushSubscription } from "../Notifications/PushSubscription";
Expand Down Expand Up @@ -193,7 +195,7 @@ import { UpdateFolderRequest } from "./Requests/UpdateFolderRequest";
import { UpdateInboxRulesRequest } from "./Requests/UpdateInboxRulesRequest";
import { UpdateItemRequest } from "./Requests/UpdateItemRequest";
import { UpdateItemResponse } from "./Responses/UpdateItemResponse";
import { UpdateUserConfigurationRequest } from './Requests/UpdateUserConfigurationRequest';
import { UpdateUserConfigurationRequest } from "./Requests/UpdateUserConfigurationRequest";
import { Uri } from "../Uri";
import { UserConfiguration } from "../Misc/UserConfiguration";
import { UserConfigurationProperties } from "../Enumerations/UserConfigurationProperties";
Expand Down Expand Up @@ -3493,14 +3495,29 @@ export class ExchangeService extends ExchangeServiceBase {
// SearchMailboxes(mailboxQueries: any[] /*System.Collections.Generic.IEnumerable<T>*/, resultType: SearchResultType): ServiceResponseCollection<TResponse> { throw new Error("ExchangeService.ts - SearchMailboxes : Not implemented."); }
// SearchMailboxes(mailboxQueries: any[] /*System.Collections.Generic.IEnumerable<T>*/, resultType: SearchResultType, sortByProperty: string, sortOrder: SortDirection, pageSize: number, pageDirection: SearchPageDirection, pageItemReference: string): ServiceResponseCollection<TResponse> { throw new Error("ExchangeService.ts - SearchMailboxes : Not implemented."); }
// SearchMailboxes(searchParameters: SearchMailboxesParameters): ServiceResponseCollection<TResponse> { throw new Error("ExchangeService.ts - SearchMailboxes : Not implemented."); }

// SetHoldOnMailboxes(holdId: string, actionType: HoldAction, query: string, inPlaceHoldIdentity: string, itemHoldPeriod: string): SetHoldOnMailboxesResponse { throw new Error("ExchangeService.ts - SetHoldOnMailboxes : Not implemented."); }
// SetHoldOnMailboxes(parameters: SetHoldOnMailboxesParameters): SetHoldOnMailboxesResponse { throw new Error("ExchangeService.ts - SetHoldOnMailboxes : Not implemented."); }
// SetHoldOnMailboxes(holdId: string, actionType: HoldAction, query: string, mailboxes: System.String[]): SetHoldOnMailboxesResponse { throw new Error("ExchangeService.ts - SetHoldOnMailboxes : Not implemented."); }
// SetHoldOnMailboxes(holdId: string, actionType: HoldAction, query: string, inPlaceHoldIdentity: string): SetHoldOnMailboxesResponse { throw new Error("ExchangeService.ts - SetHoldOnMailboxes : Not implemented."); }
// GetHoldOnMailboxes(holdId: string): GetHoldOnMailboxesResponse { throw new Error("ExchangeService.ts - GetHoldOnMailboxes : Not implemented."); }

/**
* Get hold on mailboxes
*
* @param {string} holdId Hold id
* @return {IPromise<GetHoldOnMailboxesResponse>} Service response object
*/
GetHoldOnMailboxes(holdId: string): IPromise<GetHoldOnMailboxesResponse> {
let request: GetHoldOnMailboxesRequest = new GetHoldOnMailboxesRequest(this);
request.HoldId = holdId;

return request.Execute();
}

// GetNonIndexableItemDetails(mailboxes: System.String[]): GetNonIndexableItemDetailsResponse { throw new Error("ExchangeService.ts - GetNonIndexableItemDetails : Not implemented."); }
// GetNonIndexableItemDetails(mailboxes: System.String[], pageSize: number, pageItemReference: string, pageDirection: SearchPageDirection): GetNonIndexableItemDetailsResponse { throw new Error("ExchangeService.ts - GetNonIndexableItemDetails : Not implemented."); }
// GetNonIndexableItemDetails(parameters: GetNonIndexableItemDetailsParameters): GetNonIndexableItemDetailsResponse { throw new Error("ExchangeService.ts - GetNonIndexableItemDetails : Not implemented."); }

// GetNonIndexableItemStatistics(parameters: GetNonIndexableItemStatisticsParameters): GetNonIndexableItemStatisticsResponse { throw new Error("ExchangeService.ts - GetNonIndexableItemStatistics : Not implemented."); }
// GetNonIndexableItemStatistics(mailboxes: System.String[]): GetNonIndexableItemStatisticsResponse { throw new Error("ExchangeService.ts - GetNonIndexableItemStatistics : Not implemented."); }
/* #endregion eDiscovery/Compliance operations */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EwsServiceXmlWriter } from "../EwsServiceXmlWriter";
import { ExchangeService } from '../ExchangeService';
import { ExchangeService } from "../ExchangeService";
import { ExchangeVersion } from "../../Enumerations/ExchangeVersion";
import { GetDiscoverySearchConfigurationResponse } from "../Responses/GetDiscoverySearchConfigurationResponse";
import { IPromise } from '../../Interfaces';
import { IPromise } from "../../Interfaces";
import { StringHelper } from "../../ExtensionMethods";
import { XmlElementNames } from "../XmlElementNames";
import { XmlNamespace } from "../../Enumerations/XmlNamespace";
Expand Down
113 changes: 99 additions & 14 deletions src/js/Core/Requests/GetHoldOnMailboxesRequest.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,103 @@
import {SimpleServiceRequestBase} from "./SimpleServiceRequestBase";
import {GetHoldOnMailboxesResponse} from "../Responses/GetHoldOnMailboxesResponse";
import {ExchangeVersion} from "../../Enumerations/ExchangeVersion";
import {EwsServiceXmlReader} from "../EwsServiceXmlReader";
import {EwsServiceXmlWriter} from "../EwsServiceXmlWriter";
import { EwsServiceXmlWriter } from "../EwsServiceXmlWriter";
import { ExchangeService } from "../ExchangeService";
import { ExchangeVersion } from "../../Enumerations/ExchangeVersion";
import { GetHoldOnMailboxesResponse } from "../Responses/GetHoldOnMailboxesResponse";
import { IPromise } from "../../Interfaces";
import { ServiceValidationException } from "../../Exceptions/ServiceValidationException";
import { StringHelper } from "../../ExtensionMethods";
import { Strings } from "../../Strings";
import { XmlElementNames } from "../XmlElementNames";
import { XmlNamespace } from "../../Enumerations/XmlNamespace";

import { SimpleServiceRequestBase } from "./SimpleServiceRequestBase";
/**
* ## @internal *Not Implemented*
* @internal Represents a GetHoldOnMailboxesRequest request.
*
* @sealed
*/
export class GetHoldOnMailboxesRequest extends SimpleServiceRequestBase {
HoldId: string;
Execute(): GetHoldOnMailboxesResponse { throw new Error("GetHoldOnMailboxesRequest.ts - Execute : Not implemented."); }
GetMinimumRequiredServerVersion(): ExchangeVersion { throw new Error("GetHoldOnMailboxesRequest.ts - GetMinimumRequiredServerVersion : Not implemented."); }
GetResponseXmlElementName(): string { throw new Error("GetHoldOnMailboxesRequest.ts - GetResponseXmlElementName : Not implemented."); }
GetXmlElementName(): string { throw new Error("GetHoldOnMailboxesRequest.ts - GetXmlElementName : Not implemented."); }
ParseResponse(reader: EwsServiceXmlReader): any { throw new Error("GetHoldOnMailboxesRequest.ts - ParseResponse : Not implemented."); }
Validate(): any { throw new Error("GetHoldOnMailboxesRequest.ts - Validate : Not implemented."); }
WriteElementsToXml(writer: EwsServiceXmlWriter): any { throw new Error("GetHoldOnMailboxesRequest.ts - WriteElementsToXml : Not implemented."); }

/**
* Hold id
*/
HoldId: string = null;

/**
* @internal Initializes a new instance of the **GetDiscoverySearchConfigurationRequest** class.
*
* @param {ExchangeService} service The service.
*/
constructor(service: ExchangeService) {
super(service);
}

/**
* @internal Executes this request.
*
* @return {IPromise<GetHoldOnMailboxesResponse>} Service response :Promise.
*/
Execute(): IPromise<GetHoldOnMailboxesResponse> {
return this.InternalExecute().then((serviceResponse: GetHoldOnMailboxesResponse) => {
return serviceResponse;
});
}

/**
* @internal Gets the request version.
*
* @return {ExchangeVersion} Earliest Exchange version in which this request is supported.
*/
GetMinimumRequiredServerVersion(): ExchangeVersion {
return ExchangeVersion.Exchange2013;
}

/**
* @internal Gets the name of the response XML element.
*
* @return {string} XML element name.
*/
GetResponseXmlElementName(): string {
return XmlElementNames.GetHoldOnMailboxesResponse;
}

/**
* @internal Gets the name of the XML element.
*
* @return {string} XML element name.
*/
GetXmlElementName(): string {
return XmlElementNames.GetHoldOnMailboxes;
}

/**
* @internal Parses the response.
*
* @param {any} jsonBody The js object response body.
* @return {any} Response object.
*/
ParseResponse(jsonBody: any): any {
let response: GetHoldOnMailboxesResponse = new GetHoldOnMailboxesResponse();
response.LoadFromXmlJsObject(jsonBody, this.Service);
return response;
}

/**
* @internal Validate request.
*/
Validate(): void {
super.Validate();

if (StringHelper.IsNullOrEmpty(this.HoldId)) {
throw new ServiceValidationException(Strings.HoldIdParameterIsNotSpecified);
}
}

/**
* @internal Writes the elements to XML writer.
*
* @param {EwsServiceXmlWriter} writer The writer.
*/
WriteElementsToXml(writer: EwsServiceXmlWriter): void {
writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.HoldId, this.HoldId);
}
}
4 changes: 2 additions & 2 deletions src/js/Core/Requests/GetSearchableMailboxesRequest.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EwsServiceXmlWriter } from "../EwsServiceXmlWriter";
import { ExchangeService } from '../ExchangeService';
import { ExchangeService } from "../ExchangeService";
import { ExchangeVersion } from "../../Enumerations/ExchangeVersion";
import { GetSearchableMailboxesResponse } from "../Responses/GetSearchableMailboxesResponse";
import { IPromise } from '../../Interfaces';
import { IPromise } from "../../Interfaces";
import { StringHelper } from "../../ExtensionMethods";
import { XmlElementNames } from "../XmlElementNames";
import { XmlNamespace } from "../../Enumerations/XmlNamespace";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DiscoverySearchConfiguration } from "../../MailboxSearch/DiscoverySearchConfiguration";
import { EwsServiceJsonReader } from '../EwsServiceJsonReader';
import { EwsServiceJsonReader } from "../EwsServiceJsonReader";
import { ExchangeService } from "../ExchangeService";
import { XmlElementNames } from "../XmlElementNames";

Expand Down
48 changes: 38 additions & 10 deletions src/js/Core/Responses/GetHoldOnMailboxesResponse.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,42 @@
import {ServiceResponse} from "./ServiceResponse";
import {MailboxHoldResult} from "../../MailboxSearch/MailboxHoldResult";
import {JsonObject} from "../JsonObject";
import {ExchangeService} from "../ExchangeService";
import {EwsServiceXmlReader} from "../EwsServiceXmlReader";
import { ExchangeService } from "../ExchangeService";
import { MailboxHoldResult } from "../../MailboxSearch/MailboxHoldResult";
import { XmlElementNames } from "../XmlElementNames";

import { ServiceResponse } from "./ServiceResponse";
/**
* ## *Not Implemented*
* Represents the GetHoldOnMailboxes response.
*
* @sealed
*/
export class GetHoldOnMailboxesResponse extends ServiceResponse {
HoldResult: MailboxHoldResult;
private holdResult: MailboxHoldResult;
ReadElementsFromJson(responseObject: JsonObject, service: ExchangeService): any { throw new Error("GetHoldOnMailboxesResponse.ts - ReadElementsFromJson : Not implemented."); }
ReadElementsFromXmlJsObject(reader: EwsServiceXmlReader): any { throw new Error("GetHoldOnMailboxesResponse.ts - ReadElementsFromXmlJsObject : Not implemented."); }

private holdResult: MailboxHoldResult = null;

/**
* Mailbox hold result
*/
get HoldResult(): MailboxHoldResult {
return this.holdResult;
}

/**
* @internal Initializes a new instance of the **GetHoldOnMailboxesResponse** class.
*/
constructor() {
super();
}

/**
* @internal Reads response elements from Xml JsObject.
*
* @param {any} jsObject The response object.
* @param {ExchangeService} service The service.
*/
ReadElementsFromXmlJsObject(jsObject: any, service: ExchangeService): void {
//super.ReadElementsFromXmlJsObject(jsObject, service);

if (jsObject[XmlElementNames.MailboxHoldResult]) {
this.holdResult = MailboxHoldResult.LoadFromXmlJsObject(jsObject[XmlElementNames.MailboxHoldResult], service);
}
}
}
2 changes: 1 addition & 1 deletion src/js/Core/Responses/GetSearchableMailboxesResponse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EwsServiceJsonReader } from '../EwsServiceJsonReader';
import { EwsServiceJsonReader } from "../EwsServiceJsonReader";
import { ExchangeService } from "../ExchangeService";
import { FailedSearchMailbox } from "../../MailboxSearch/FailedSearchMailbox";
import { SearchableMailbox } from "../../MailboxSearch/SearchableMailbox";
Expand Down
4 changes: 2 additions & 2 deletions src/js/MailboxSearch/DiscoverySearchConfiguration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EwsServiceJsonReader } from '../Core/EwsServiceJsonReader';
import { ExchangeService } from '../Core/ExchangeService';
import { EwsServiceJsonReader } from "../Core/EwsServiceJsonReader";
import { ExchangeService } from "../Core/ExchangeService";
import { SearchableMailbox } from "./SearchableMailbox";
import { XmlElementNames } from "../Core/XmlElementNames";

Expand Down
73 changes: 63 additions & 10 deletions src/js/MailboxSearch/MailboxHoldResult.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,72 @@
import {MailboxHoldStatus} from "./MailboxHoldStatus";
import {JsonObject} from "../Core/JsonObject";
import {EwsServiceXmlReader} from "../Core/EwsServiceXmlReader";
import { EwsServiceJsonReader } from '../Core/EwsServiceJsonReader';
import { ExchangeService } from './../Core/ExchangeService';
import { HoldStatus } from "../Enumerations/HoldStatus";
import { MailboxHoldStatus } from "./MailboxHoldStatus";
import { XmlElementNames } from "../Core/XmlElementNames";

/**
* Represents mailbox hold result
*
* @sealed
*/
export class MailboxHoldResult {
HoldId: string;
Query: string;
Statuses: MailboxHoldStatus[];
LoadFromJson(jsonObject: JsonObject): MailboxHoldResult { throw new Error("MailboxHoldResult.ts - LoadFromJson : Not implemented."); }
LoadFromXml(reader: EwsServiceXmlReader): MailboxHoldResult { throw new Error("MailboxHoldResult.ts - LoadFromXml : Not implemented."); }
}

/**
* Hold id
*/
HoldId: string = null;

/**
* Query
*/
Query: string = null;

/**
* Collection of mailbox status
*/
Statuses: MailboxHoldStatus[] = null;

/**
* @internal Loads service object from XML.
*
* @param {any} jsObject Json Object converted from XML.
* @param {ExchangeService} service The service.
* @return {MailboxHoldResult} Mailbox hold object
*/
static LoadFromXmlJsObject(jsObject: any, service: ExchangeService): MailboxHoldResult {
let statuses: MailboxHoldStatus[] = [];
let holdResult: MailboxHoldResult = new MailboxHoldResult();

if (jsObject[XmlElementNames.HoldId]) {
holdResult.HoldId = jsObject[XmlElementNames.HoldId];
}

if (jsObject[XmlElementNames.Query]) {
holdResult.Query = jsObject[XmlElementNames.Query];
}

//}
if (jsObject[XmlElementNames.MailboxHoldStatuses]) {
for (let statusObject of EwsServiceJsonReader.ReadAsArray(jsObject[XmlElementNames.MailboxHoldStatuses], XmlElementNames.MailboxHoldStatus)) {

let status: MailboxHoldStatus = new MailboxHoldStatus();

if (statusObject[XmlElementNames.Mailbox]) {
status.Mailbox = statusObject[XmlElementNames.Mailbox];
}
if (statusObject[XmlElementNames.Status]) {
status.Status = HoldStatus[<string>statusObject[XmlElementNames.Status]];
}

if (statusObject[XmlElementNames.AdditionalInfo]) {
status.AdditionalInfo = statusObject[XmlElementNames.AdditionalInfo];
}

statuses.push(status);
}
}

holdResult.Statuses = statuses.length == 0 ? null : statuses;

return holdResult;
}
}
Loading

0 comments on commit 4d25181

Please sign in to comment.