BuildSubscribeToPullNotificationsRequest method

SubscribeToPullNotificationsRequest BuildSubscribeToPullNotificationsRequest(
  1. Iterable<FolderId>? folderIds,
  2. int timeout,
  3. String? watermark,
  4. List<EventType> eventTypes,
)
Builds a request to subscribe to pull notifications in the authenticated user's mailbox. The Ids of the folder to subscribe to. The timeout, in minutes, after which the subscription expires. Timeout must be between 1 and 1440. An optional watermark representing a previously opened subscription. The event types to subscribe to.

Implementation

SubscribeToPullNotificationsRequest BuildSubscribeToPullNotificationsRequest(
  Iterable<FolderId>? folderIds,
  int timeout,
  String? watermark,
  List<EventType> eventTypes,
) {
  if (timeout < 1 || timeout > 1440) {
    throw ArgumentException(
      "The timeout must be a value between 1 and 1440 minutes.",
    );
  }

  EwsUtilities.ValidateParamCollection(eventTypes, "eventTypes");

  SubscribeToPullNotificationsRequest request =
      SubscribeToPullNotificationsRequest(this);

  if (folderIds != null) {
    request.FolderIds!.AddRangeFolderIds(folderIds);
  }

  request.Timeout = timeout;
  request.EventTypes.addAll(eventTypes);
  request.Watermark = watermark;

  return request;
}