Reputation: 76609
The documentation for the PropertiesService lists both, the ScriptProperties and UserProperties as:
Deprecated. This class is deprecated and should not be used in new scripts.
... while the DocumentProperties
seem to have no page in the documentation.
Q: is there any suitable replacement for these classes, in order to use them in new scripts?
Upvotes: 3
Views: 1991
Reputation:
The replacement for the deprecated classes is the class Properties
.
PropertiesService
has three methods getDocumentProperties()
, getScriptProperties()
, and getUserProperties()
. Perhaps once upon a time these returned objects of those deprecated classes; but now they all return an object of class Properties
.
Script properties, user properties, and document properties remain available and they are non-deprecated; it's just that the classes have been unified into Properties.
var sp = PropertiesService.getScriptProperties();
sp.setProperty("foo", "bar");
var up = PropertiesService.getUserProperties();
up.setProperty("foo", "baz");
var dp = PropertiesService.getDocumentProperties();
dp.setProperty("foo", "blargh");
Logger.log([sp.getProperty("foo"), up.getProperty("foo"), dp.getProperty("foo")]);
logs [bar, baz, blargh]
.
Upvotes: 8