UserProperties


**Deprecated.** This class is deprecated and should not be used in new scripts.

User Properties are key-value pairs unique to a user. User Properties are scoped per user; any
script running under the identity of a user can access User Properties for that user only.

### Deprecated methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/properties/user-properties#deleteAllProperties()` | `https://developers.google.com/apps-script/reference/properties/user-properties#` | Deletes all properties. |
| `https://developers.google.com/apps-script/reference/properties/user-properties#deleteProperty(String)` | `https://developers.google.com/apps-script/reference/properties/user-properties#` | Deletes the property with the given key. |
| `https://developers.google.com/apps-script/reference/properties/user-properties#getKeys()` | `String[]` | Get all of the available keys. |
| `https://developers.google.com/apps-script/reference/properties/user-properties#getProperties()` | `Object` | Get all of the available properties at once. |
| `https://developers.google.com/apps-script/reference/properties/user-properties#getProperty(String)` | `String|null` | Returns the value associated with the provided key, or `null` if there is no such value. |
| `https://developers.google.com/apps-script/reference/properties/user-properties#setProperties(Object)` | `https://developers.google.com/apps-script/reference/properties/user-properties#` | Bulk-sets all the properties drawn from the given object. |
| `https://developers.google.com/apps-script/reference/properties/user-properties#setProperties(Object,Boolean)` | `https://developers.google.com/apps-script/reference/properties/user-properties#` | Bulk-sets all the properties drawn from the given object. |
| `https://developers.google.com/apps-script/reference/properties/user-properties#setProperty(String,String)` | `https://developers.google.com/apps-script/reference/properties/user-properties#` | Persists the specified in value with the provided key. |

## Deprecated methods

### `deleteAllProperties()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Deletes all properties.

```javascript
UserProperties.deleteAllProperties();
```

#### Return


`https://developers.google.com/apps-script/reference/properties/user-properties#` --- this object, for chaining

#### See also

- `https://developers.google.com/apps-script/reference/properties/user-properties#deleteProperty(String)`

*** ** * ** ***

### `deleteProperty(key)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Deletes the property with the given key.

```javascript
UserProperties.deleteProperty('special');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `key` | `String` | key for property to delete |

#### Return


`https://developers.google.com/apps-script/reference/properties/user-properties#` --- this object, for chaining

#### See also

- `https://developers.google.com/apps-script/reference/properties/user-properties#deleteAllProperties()`

*** ** * ** ***

### `getKeys()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Get all of the available keys.

#### Return


`String[]`

*** ** * ** ***

### `getProperties()`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Get all of the available properties at once.

This gives a copy, not a live view, so changing the properties on the returned object won't
update them in storage and vice versa.

```javascript
UserProperties.setProperties({
  "cow"     : "moo",
  "sheep"   : "baa",
  "chicken" : "cluck"
});

// Logs "A cow goes: moo"
Logger.log("A cow goes: %s", UserProperties.getProperty("cow"));

// This makes a copy. Any changes that happen here will not
// be written back to properties.
var animalSounds = UserProperties.getProperties();

// Logs:
// A chicken goes cluck!
// A cow goes moo!
// A sheep goes baa!
for(var kind in animalSounds) {
  Logger.log("A %s goes %s!", kind, animalSounds[kind]);
}
```

#### Return


`Object` --- a copy of the properties containing key-value pairs

*** ** * ** ***

### `getProperty(key)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Returns the value associated with the provided key, or `null` if there is no such value.

```javascript
const specialValue = UserProperties.getProperty('special');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `key` | `String` | key for the value to retrieve |

#### Return


`String|null` --- the value associated with the key

#### See also

- `https://developers.google.com/apps-script/reference/properties/user-properties#setProperty(String,String)`

*** ** * ** ***

### `setProperties(properties)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Bulk-sets all the properties drawn from the given object.

```javascript
UserProperties.setProperties({special: 'sauce', 'meaning': 42});
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `properties` | `Object` | an object containing the properties to set. |

#### Return


`https://developers.google.com/apps-script/reference/properties/user-properties#` --- this object, for chaining

#### See also

- `https://developers.google.com/apps-script/reference/properties/user-properties#setProperty(String,String)`

*** ** * ** ***

### `setProperties(properties, deleteAllOthers)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Bulk-sets all the properties drawn from the given object.

```javascript
// This deletes all other properties
UserProperties.setProperties({special: 'sauce', 'meaning': 42}, true);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `properties` | `Object` | an object containing the properties to set. |
| `deleteAllOthers` | `Boolean` | whether to delete all existing properties. |

#### Return


`https://developers.google.com/apps-script/reference/properties/user-properties#` --- this object, for chaining

#### See also

- `https://developers.google.com/apps-script/reference/properties/user-properties#setProperty(String,String)`

*** ** * ** ***

### `setProperty(key, value)`


**Deprecated.** This function is deprecated and should not be used in new scripts.

Persists the specified in value with the provided key. Any existing value associated with this
key will be overwritten.

```javascript
UserProperties.setProperty('special', 'sauce');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `key` | `String` | key for property |
| `value` | `String` | value to associate with the key |

#### Return


`https://developers.google.com/apps-script/reference/properties/user-properties#` --- this object, for chaining

#### See also

- `https://developers.google.com/apps-script/reference/properties/user-properties#getProperty(String)`