> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Archive agent

## Get NSArchiveListItem

These examples uses the **ContactActivity** archive provider to retrieve [appointments][1].

```crmscript! theme={null}

/*
Using archive provider with using ArchiveRestrictionInfo to represent search terms
*/

String[] columns;
columns.pushBack("text");

NSArchiveOrderByInfo[] sortOrder;

NSArchiveRestrictionInfo[] restrictions;
NSArchiveRestrictionInfo selectAll;
selectAll.SetName("getAllRows");
restrictions.pushBack(selectAll);

String[] entities;
entities.pushBack("appointment");

NSArchiveAgent agent;
NSArchiveListItem[] result = agent.GetArchiveListByColumns("ContactActivity", columns, sortOrder, restrictions, entities, 0, 100);

foreach (NSArchiveListItem i in result) {
  Map col = i.GetColumnData();
  col.first();
  while (!col.eof()) {
    print(col.getKey() + ": " + col.getVal() + "\n");
    col.next();
  }
}
```

```crmscript! theme={null}
/*
Using archive provider with using String to represent search terms
*/

NSArchiveAgent agent;
NSArchiveListItem[] result = agent.GetArchiveListByColumns2("ContactActivity", "text", "", "getAllRows=1", "appointment", 0, 100);

foreach (NSArchiveListItem i in result) {
  Map col = i.GetColumnData();
  col.first();
  while (!col.eof()) {
    print(col.getKey() + ": " + col.getVal() + "\n");
    col.next();
  }
}
```

[1]: ../howto/diary/get-appointment


## Related topics

- [Archive agents](/en/api/search/iarchiveagent/index.md)
- [Archive Metadata](/en/api/search/odata/metadata.md)
- [NSArchiveAgent](/en/automation/crmscript/reference/CRMScript.NetServer.NSArchiveAgent.md)
- [Get Archive List2](/en/api/reference/restful/agent/archive_agent/get-archive-list2.md)
- [SuperOffice.WebApi.Agents.ArchiveAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ArchiveAgent.md)
- [How to use multiple criteria with the ArchiveAgent](/en/api/search/iarchiveagent/using-criteria.md)
