# UXP: Cannot clear metadataPreferences

**URL:** https://forums.creativeclouddeveloper.com/t/uxp-cannot-clear-metadatapreferences/11775
**Category:** InDesign
**Tags:** bug, uxp
**Created:** [March 10, 2026, 1:11pm UTC](https://forums.creativeclouddeveloper.com/t/uxp-cannot-clear-metadatapreferences/11775 "2026-03-10T13:11:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![roman-edv](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/roman-edv/32/4332_2.png) [@roman-edv](https://forums.creativeclouddeveloper.com/u/roman-edv)
#### Post date: [March 10, 2026, 1:11pm UTC](https://forums.creativeclouddeveloper.com/t/uxp-cannot-clear-metadatapreferences/11775/1 "2026-03-10T13:11:32Z")

</div>

Assigning an empty string to a string property within `Document.metadataPreferences` (such as `copyrightNotice`) fails to clear it. The assignment is silently ignored, and the existing string remains unchanged. You can change it to any value, but not an empty-ish string.

**Example from UXP Dev Tools Console):**

```auto
> doc.metadataPreferences["copyrightNotice"] = "TEST"
"TEST"
> doc.metadataPreferences["copyrightNotice"] = "" # trying to set empty string
""
> doc.metadataPreferences["copyrightNotice"]
"TEST" # should be ''
> doc.metadataPreferences["copyrightNotice"] = "TEST UPDATE"
"TEST UPDATE" 
> doc.metadataPreferences["copyrightNotice"]
"TEST UPDATE" # updating the string worked
> doc.metadataPreferences["copyrightNotice"] = '' # trying single quote empty string
""
> doc.metadataPreferences["copyrightNotice"]
"TEST UPDATE" # the previous state remained, field wasn't emptied
> doc.metadataPreferences["copyrightNotice"] = " " # trying one space as "empty-ish" string
" "
> doc.metadataPreferences["copyrightNotice"]
"TEST UPDATE" # did not work
> doc.metadataPreferences["copyrightNotice"] = "\n" # trying a line break as another whitespace character
"\n"
> doc.metadataPreferences["copyrightNotice"]
"\n" # changing to a line break worked, seems to not be considered empty

```

**Expected Behavior:**  
Assigning an empty string should clear the metadata property.

**Actual Behavior:**  
The empty string assignment is silently ignored. The property retains its previously set value.

**Additional Context:**

- Attempting to clear the property with `null` or `undefined` is not possible, as it throws a strict type error: `Uncaught Error: Invalid value for property setup 'copyrightNotice'. Expected String, but received nothing.`
- The issue occurs both within UXP plugins and directly in the UXP JS Console.`

**Environment:**

- Application: Adobe InDesign 21.2
- API: UXP Scripting

---

<div class="post-metadata">

### Author: ![Roland\_Dreger](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/roland_dreger/32/3702_2.png) [@Roland\_Dreger](https://forums.creativeclouddeveloper.com/u/Roland_Dreger)
#### Post date: [March 15, 2026, 5:00pm UTC](https://forums.creativeclouddeveloper.com/t/uxp-cannot-clear-metadatapreferences/11775/2 "2026-03-15T17:00:31Z")

</div>

Hi Roman,

take a look at the [`setProperty`](https://www.indesignjs.de/extendscriptAPI/indesign-latest/#MetadataPreference.html#d1e418961__d1e419576) method for `MetadataPreferences`.

This should allow you to remove the entire container:

XMP

```auto
...
<dc:rights>
   <rdf:Alt>
       <rdf:li xml:lang="x-default">Copyright</rdf:li>
   </rdf:Alt>
</dc:rights>
...

```

Code

```auto
app.activeDocument.metadataPreferences.setProperty("http://purl.org/dc/elements/1.1/", "dc:rights", "")

```

Adobe Bridge also has a `deleteProperty` method, but InDesign does not.

Roland

---

<div class="post-metadata">

### Author: ![roman-edv](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/roman-edv/32/4332_2.png) [@roman-edv](https://forums.creativeclouddeveloper.com/u/roman-edv)
#### Post date: [March 16, 2026, 10:17am UTC](https://forums.creativeclouddeveloper.com/t/uxp-cannot-clear-metadatapreferences/11775/3 "2026-03-16T10:17:15Z")

</div>

Thanks Roland, that’s a good workaround!
