AWS SDK for .NET Documentation
UpdateItemRequest Class
AmazonAmazon.DynamoDB.ModelUpdateItemRequest Did this page help you?   Yes   No    Tell us about it...
Container for the parameters to the UpdateItem operation.

Edits an existing item's attributes.

You can perform a conditional update (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values).

Declaration Syntax
public class UpdateItemRequest : AmazonWebServiceRequest
All MembersConstructorsMethodsProperties

Initializes a new instance of the UpdateItemRequest class

Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.

Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Designates an attribute for a conditional modification. The Expected parameter allows you to provide an attribute name, and whether or not Amazon DynamoDB should check to see if the attribute has a particular value before modifying it.

Serves as a hash function for a particular type.
(Inherited from Object.)
Gets the type of the current instance.
(Inherited from Object.)
The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.

Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.
  • NONE: Nothing is returned.
  • ALL_OLD: Returns the attributes of the item as they were before the operation.
  • UPDATED_OLD: Returns the values of the updated attributes, only, as they were before the operation.
  • ALL_NEW: Returns all the attributes and their new values after the operation.
  • UPDATED_NEW: Returns the values of the updated attributes, only, as they are after the operation.


Allowed Values

The name of the table in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).


3 - 255

Returns a string that represents the current object.
(Inherited from Object.)
WithAttributeUpdates(array<KeyValuePair<(Of <<'(String, AttributeValueUpdate>)>>)>[]()[][]) Obsolete.
Adds the KeyValuePairs to the AttributeUpdates dictionary.

WithExpected(array<KeyValuePair<(Of <<'(String, ExpectedAttributeValue>)>>)>[]()[][]) Obsolete.
Adds the KeyValuePairs to the Expected dictionary.

WithKey(Key) Obsolete.
Sets the Key property

WithReturnValues(String) Obsolete.
Sets the ReturnValues property

WithTableName(String) Obsolete.
Sets the TableName property


This example shows how to update an item in a table.

CopyUpdateItem sample
// Create a client
AmazonDynamoDBClient client = new AmazonDynamoDBClient();

// Define item key
//  Hash-key of the target item is string value "Mark Twain"
//  Range-key of the target item is string value "The Adventures of Tom Sawyer"
Key key = new Key
    HashKeyElement = new AttributeValue { S = "Mark Twain" },
    RangeKeyElement = new AttributeValue { S = "The Adventures of Tom Sawyer" }

// Define attribute updates
Dictionary<string, AttributeValueUpdate> updates = new Dictionary<string, AttributeValueUpdate>();
// Update item's Setting attribute
updates["Setting"] = new AttributeValueUpdate()
    .WithValue(new AttributeValue { S = "St. Petersburg, Missouri" });
// Remove item's Bibliography attribute
updates["Bibliography"] = new AttributeValueUpdate()
// Add a new string to the item's Genres SS attribute
updates["Genres"] = new AttributeValueUpdate()
    .WithValue(new AttributeValue { SS = new List<string> { "Bildungsroman" } });

// Create UpdateItem request
UpdateItemRequest request = new UpdateItemRequest
    TableName = "SampleTable",
    Key = key,
    AttributeUpdates = updates

// Issue request
Inheritance Hierarchy
See Also

Assembly: AWSSDK (Module: AWSSDK) Version: (