Updating folder property via pipeline

Jenkins setup: Jenkins 2.440.1

Can we update folder property from a groovy pipeline script based on some conditions?


                setFolderProperty(folderName, 'GIT_TAG', params.GIT_TAG)

Its throwing me below errro

: 4: unable to resolve class com.cloudbees.hudson.plugins.folder.properties.FolderProperties
@ line 4, column 1.
import com.cloudbees.hudson.plugins.folder.properties.FolderProperties
^

Neither Folders nor Folder Properties seem to provide any explicit steps for the pipeline to update the properties on a folder.

You might be able to do that by accessing the plugin’s Java API directly – likely abstracting that into a secure shared library function, to avoid tons of security alerts – but the very idea sounds extremely brittle.

May I ask, why would you need to programmatically update such properties?