---
title: clsAgencyOfficeCollection
summary: API reference for clsAgencyOfficeCollection.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Agency
reference_type: package
---

# clsAgencyOfficeCollection

`clsAgencyOfficeCollection` is the BOF collection façade for office rows. It retrieves all office/location rows for an agency, supports active-date filtering, and provides the clone helper used to aggregate active offices across agencies.

## Purpose
- Retrieve office rows for one agency.
- Provide in-memory active and expired office subsets.
- Support cross-agency aggregation through the clone helper.

## Context
- Namespace: `SAIF.Business.Policy.Agency`
- Assembly/package: `SAIF.Business.Policy.Agency`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Item` (index) | `Default Public ReadOnly Property Item(ByVal Index As Integer) As clsAgencyOffice` | Returns the office at the given zero-based position in the collection. |
| `Item` (office number) | `Default Public ReadOnly Property Item(ByVal inAgencyOfficeNumber As String) As clsAgencyOffice` | Looks up an office in the collection by its office number. |
| `CurrentItem` | `Public Shadows ReadOnly Property CurrentItem() As clsAgencyOffice` | Returns the office at the collection's current cursor position, typed as `clsAgencyOffice` rather than the base collection's untyped current item. |
| `Active` | `Public ReadOnly Property Active(ByVal inDate As Date) As clsAgencyOfficeCollection` | Returns only offices active on the requested date. |
| `Expired` | `Public ReadOnly Property Expired() As clsAgencyOfficeCollection` | Returns only offices already expired. |
| `Contains` | `Public Overloads Function Contains(ByVal inAgencyOffice As clsAgencyOffice) As Boolean` | Reports whether an office instance is already present. |
| `Contains` (office number) | `Public Overloads Function Contains(ByVal inAgencyOfficeNumber As Decimal) As Boolean` | Reports whether an office with the given office number is already present. |
| `GetAgencyOfficeCollection` | `Public Shared Function GetAgencyOfficeCollection(ByVal inDataportal As IDataPortalInfo, ByVal inAgencySeqNum As Decimal) As clsAgencyOfficeCollection` | Entry point for agency-scoped office retrieval. |

## Inherited public members

Members in this section are inherited from `clsBusinessCollectionBase` in `SAIF.Framework.Core`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| `First` | `Sub First()` | Moves the collection cursor to the first office.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Last` | `Sub Last()` | Moves the collection cursor to the last office.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Next` | `Sub Next()` | Advances the collection cursor.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Previous` | `Sub Previous()` | Moves the collection cursor backward.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `SetCurrent` | `Sub SetCurrent(item As Object)` | Assigns the current-item position used by BOF traversal helpers.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Traverse` | `Sub Traverse(inDirection As TraverseDirection)` (via `ITraversion`) | Advances the cursor according to a supplied direction/step.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Error` | `ReadOnly Property Error As String` (via `IDataErrorInfo`) | Returns a summary validation-error message aggregated across collection items.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Item(columnName)` | `ReadOnly Property Item(columnName As String) As String` (via `IDataErrorInfo`) | Returns a per-property validation-error message for the collection.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `DeletedCollection` | `Protected Class DeletedCollection` (inherits `CollectionBase`) | Tracks items removed from the collection for inclusion in save/delete operations.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `SortDirection` | `ReadOnly Property SortDirection() As ListSortDirection` | Returns the direction of the most recent sort.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `SortProperty` | `ReadOnly Property SortProperty() As String` | Returns the name of the property the collection is currently sorted by.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `Sort` / `SortMulti` | `Sub Sort(aProp As String, [aDir As ListSortDirection = Ascending], [stable As StableSortSetting = Default])` / `Sub SortMulti(aParms() As SortParm)` | Sorts the collection by one property, or by multiple properties in sequence using a stable sort.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `Find` / `FindMulti` / `BinarySearch` | `Function Find(aProp As String, aKey As Object) As Integer` / `Function FindMulti(aParms() As FindParm) As Integer` / `Function BinarySearch(aProp As String, aKey As Object) As Integer` | Locates an item by one or more property/value pairs, or by binary search on an already-sorted collection.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `Shuffle` | `Sub Shuffle()` | Randomizes item order.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `RemoveLinks` / `LinkItems` | `Sub RemoveLinks()` / `Sub LinkItems()` | Manages a doubly linked list across `ILinkItem` children so siblings can reference each other.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |

## Behavioral notes
- `AddClone` is a non-public helper, but it is central to the library's active-office aggregation behavior.
- Office rows are filtered in memory once the agency-scoped retrieve has completed.

## Constraints and usage notes
- The collection only retrieves offices for one agency at a time; cross-agency aggregation is performed by `clsAgencyCollection`.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `Business\SAIF.Business.Policy.Agency\clsAgencyOfficeCollection.vb`
