---
schema_version: "1"
id: 4ca8971a92b3f941a1ac8063431cbfa312dd7107c58c80bbb46c8cc4fde5efed
title: SetObjectProperty()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/api/mc-ampscript-reference-api-set-object-property.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-set-object-property.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3ec1e81741bb166d939c11fdd7624d2a96a6a7563381464fb6d8dc7580af0d25
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# SetObjectProperty()

Sets a value for an object created by the `CreateObject()` function.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>❌ No</td>
  </tr>
</table>

## Syntax

```
SetObjectProperty(apiObject,
                  propertyName,
                  propertyValue)
```

The `SetObjectProperty()` function has three parameters:

- `apiObject` (API Object): Required. The API Object that you’re setting a value for.
- `propertyName` (string): Required. The name of the property to assign a value to.
- `propertyValue` (string): Required. The value to assign to the property.

## Usage

This example creates an API Object called Subscriber, gives it the EmailAddress property, and sets the value of that property to an email address.

```
Var @email, @subscriber

Set @email = "miyuki.noguchi@example.com"
Set @subscriber=CreateObject('Subscriber')
SetObjectProperty(@subscriber, 'EmailAddress', @email)
```

## See Also

- [CreateObject()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-create-object.md)
- [API Create Method](https://developer.salesforce.com/docs/marketing/guides/mc-apis/create.md)
