# How to expose previously used values for a property included in a vault

**URL:** <https://forum.obsidian.md/t/how-to-expose-previously-used-values-for-a-property-included-in-a-vault/64835>\
**Category:** Devs: Plugins & API\
**Tags:** api\
**Created:** [August 10, 2023, 3:39pm UTC](https://forum.obsidian.md/t/how-to-expose-previously-used-values-for-a-property-included-in-a-vault/64835 "2023-08-10T15:39:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliverlalan](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@oliverlalan](https://forum.obsidian.md/u/oliverlalan)\
**Post date:** [August 10, 2023, 3:39pm UTC](https://forum.obsidian.md/t/how-to-expose-previously-used-values-for-a-property-included-in-a-vault/64835/1 "2023-08-10T15:39:55Z")

</div>

Is there any function that returns a list with all the previously used values for a given property in my Vault? I have checked the [API documentation](https://docs.obsidian.md/), but I was not able to find any.

I want to create a QuickAdd macro that suggests those values, but I have not been able to find any function in the API documentation.

---

<div class="post-metadata">

**Author:** ![jionnyMagiah](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/j/a183cd/32.png) [@jionnyMagiah](https://forum.obsidian.md/u/jionnyMagiah)\
**Post date:** [January 28, 2026, 3:51pm UTC](https://forum.obsidian.md/t/how-to-expose-previously-used-values-for-a-property-included-in-a-vault/64835/2 "2026-01-28T15:51:34Z")

</div>

I did this. I get all the files from the vault. Then for each file I get the frontamatter from `metadataCache`. `key` is the name of the property I need. I put all the values into an array, then remove falsy values and flat the array (if `key` is a list property you get an array from `frontMatter`)

```ts
function getAllValuesForKey(key: string): string[] {
    const files = this.app.vault.getFiles();
    let values: string[] = [];
    files.forEach((file) => {
        const cache = this.app.metadataCache.getFileCache(file)?.frontmatter;
        values.push(cache?.[key]);
    });

    values = [...new Set(values.filter((v) => !!v).flat())];

    return values;
}

```

Performance wise is not too bad, it takes a few milliseconds to process a vault almost 600 files
