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

Deletes a single item in a table by primary key.

You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value.

Declaration Syntax
C#
public class DeleteItemRequest : AmazonWebServiceRequest
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
DeleteItemRequest()()()()
Initializes a new instance of the DeleteItemRequest class

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Expected
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.

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 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.

ReturnValues
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.

Constraints:

Allowed Values
NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW


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

Constraints:

Length
3 - 255
Pattern
[a-zA-Z0-9_.-]+


ToString()()()()
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.

WithKey(Key) Obsolete.
Sets the Key property

WithReturnValues(String) Obsolete.
Sets the ReturnValues property

WithTableName(String) Obsolete.
Sets the TableName property

Examples

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

CopyDeleteItem 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" }
};

// Create DeleteItem request
DeleteItemRequest request = new DeleteItemRequest
{
    TableName = "SampleTable",
    Key = key
};

// Issue request
client.DeleteItem(request);
Inheritance Hierarchy
See Also

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)