Container for the parameters to the UpdateItem operation.
            
Edits an existing item's attributes, or inserts a new item if it does not already exist. You can put, delete, or add attribute values. You can also 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).
In addition to updating an item, you can also return the item's attribute values in the same operation, using the ReturnValues parameter.
 Declaration Syntax
 Declaration Syntax| C# | 
public class UpdateItemRequest : AmazonWebServiceRequest
 Members
 Members| All Members | Constructors | Methods | Properties | ||
| Icon | Member | Description | ||
|---|---|---|---|---|
|  | UpdateItemRequest()()()() | Initializes a new instance of the UpdateItemRequest class | ||
|  | AttributeUpdates | 
            The names of attributes to be modified, the action to perform on each, and the new value for each. If you are updating an attribute that is
            an index key attribute for any indexes on that table, the attribute type must match the index key type defined in the
            AttributesDefinition of the table description. You can use UpdateItem to update any non-key attributes. Attribute values
            cannot be null. String and binary type attributes must have lengths greater than zero. Set type attributes must not be empty. Requests with
            empty values will be rejected with a ValidationException. Each AttributeUpdates element consists of an attribute name to
            modify, along with the following:  
 | ||
|  | ConditionalOperator | 
            A logical operator to apply to the conditions in the Expected map:  
 Constraints: | ||
|  | Equals(Object) | (Inherited from Object.) | ||
|  | Expected | 
            A map of attribute/condition pairs. This is the conditional block for the UpdateItem operation. All the conditions must evaluate to
            true for the operation to succeed. Expected allows you to provide an attribute name, and whether or not DynamoDB should check to see
            if the attribute value already exists; or if the attribute value exists and has a particular value before changing it. Each item in
            Expected represents an attribute name for DynamoDB to check, along with the following:  
 | ||
|  | GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) | ||
|  | GetType()()()() | Gets the type of the current instance.(Inherited from Object.) | ||
|  | Key | 
            The primary key that defines the item. Each element consists of an attribute name and a value for that attribute.
             
             | ||
|  | ReturnConsumedCapacity | 
            If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response
            includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
             
             Constraints: | ||
|  | ReturnItemCollectionMetrics | 
            If set to SIZE, statistics about item collections, if any, that were modified during the operation are returned in the response. If
            set to NONE (the default), no statistics are returned.
             
             Constraints: | ||
|  | ReturnValues | 
            Use ReturnValues if you want to get the item attributes as they appeared either before or after they were updated. For
            UpdateItem, the valid values are:  
 Constraints: | ||
|  | TableName | 
            The name of the table containing the item to update.
             
             Constraints: | ||
|  | ToString()()()() | 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.
             | ||
|  | WithConditionalOperator(String) | Obsolete. 
            Sets the ConditionalOperator property
             | ||
|  | WithExpected(array<KeyValuePair<(Of <<'(String, ExpectedAttributeValue>)>>)>[]()[][]) | Obsolete. 
            Adds the KeyValuePairs to the Expected dictionary.
             | ||
|  | WithKey(array<KeyValuePair<(Of <<'(String, AttributeValue>)>>)>[]()[][]) | Obsolete. 
            Adds the KeyValuePairs to the Key dictionary.
             | ||
|  | WithReturnConsumedCapacity(String) | Obsolete. 
            Sets the ReturnConsumedCapacity property
             | ||
|  | WithReturnItemCollectionMetrics(String) | Obsolete. 
            Sets the ReturnItemCollectionMetrics property
             | ||
|  | WithReturnValues(String) | Obsolete. 
            Sets the ReturnValues property
             | ||
|  | WithTableName(String) | Obsolete. 
            Sets the TableName property
             | 
 Examples
 ExamplesThis example shows how to update an item in a table.
 CopyUpdateItem sample
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" Dictionary<string, AttributeValue> key = new Dictionary<string, AttributeValue> { { "Author", new AttributeValue { S = "Mark Twain" } }, { "Title", 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() .WithAction("PUT") .WithValue(new AttributeValue { S = "St. Petersburg, Missouri" }); // Remove item's Bibliography attribute updates["Bibliography"] = new AttributeValueUpdate() .WithAction("DELETE"); // Add a new string to the item's Genres SS attribute updates["Genres"] = new AttributeValueUpdate() .WithAction("ADD") .WithValue(new AttributeValue { SS = new List<string> { "Bildungsroman" } }); // Create UpdateItem request UpdateItemRequest request = new UpdateItemRequest { TableName = "SampleTable", Key = key, AttributeUpdates = updates }; // Issue request client.UpdateItem(request);
 Inheritance Hierarchy
 Inheritance Hierarchy| Object | ||
|  | AmazonWebServiceRequest | |
|  | UpdateItemRequest | |
 See Also
 See Also Note:
 Note: