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

Creates a new item, or replaces an old item with a new item (including all the attributes).

If an item already exists in the specified table with the same primary key, the new item completely replaces the existing item. You can perform a conditional put (insert a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values.

Declaration Syntax
public class PutItemRequest : AmazonWebServiceRequest
All MembersConstructorsMethodsProperties

Initializes a new instance of the PutItemRequest class

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.)
A map of the attributes for the item, and must include the primary key values that define the item. Other attribute name-value pairs can be provided for the item.

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 put 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.)
WithExpected(array<KeyValuePair<(Of <<'(String, ExpectedAttributeValue>)>>)>[]()[][]) Obsolete.
Adds the KeyValuePairs to the Expected dictionary.

WithItem(array<KeyValuePair<(Of <<'(String, AttributeValue>)>>)>[]()[][]) Obsolete.
Adds the KeyValuePairs to the Item dictionary.

WithReturnValues(String) Obsolete.
Sets the ReturnValues property

WithTableName(String) Obsolete.
Sets the TableName property


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

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

// Define item attributes
Dictionary<string, AttributeValue> attributes = new Dictionary<string, AttributeValue>();
// Author is hash-key
attributes["Author"] = new AttributeValue { S = "Mark Twain" };
// Title is range-key
attributes["Title"] = new AttributeValue { S = "The Adventures of Tom Sawyer" };
// Other attributes
attributes["Year"] = new AttributeValue { N = "1876" };
attributes["Setting"] = new AttributeValue { S = "Missouri" };
attributes["Pages"] = new AttributeValue { N = "275" };
attributes["Genres"] = new AttributeValue
    SS = new List<string> { "Satire", "Folk", "Children's Novel" }

// Create PutItem request
PutItemRequest request = new PutItemRequest
    TableName = "SampleTable",
    Item = attributes

// Issue PutItem request
Inheritance Hierarchy
See Also

Assembly: AWSSDK (Module: AWSSDK) Version: (