User guide
Table Of Contents
- AWS SDK for .NET
- Table of Contents
- AWS SDK for .NET Developer Guide
- Getting Started with the AWS SDK for .NET
- Programming with the AWS SDK for .NET
- AWS SDK for .NET Tutorials and Examples
- Managing ASP.NET Session State with Amazon DynamoDB
- Tutorial: Creating Amazon EC2 Instances with the AWS SDK for .NET
- Tutorial: Grant Access Using an IAM Role and the AWS SDK for .NET
- Tutorial: Amazon EC2 Spot Instances
- Creating and Using an Amazon SQS Queue with the AWS SDK for .NET
- Creating an Amazon Route 53 Hosted Zone and Adding Resource Record Sets
- Additional Resources
- Document History

// Create a PutObject request
//
// You will need to change the BucketName below in order to run this
// sample code.
//
PutObjectRequest request = new PutObjectRequest
{
BucketName = "PUT-YOUR-OWN-EXISTING-BUCKET-NAME-HERE",
Key = "Item",
ContentBody = "This is sample content..."
};
response = client.PutObject(request);
Console.WriteLine("Finished PutObject operation for {0}.", request.Key);
Console.WriteLine("Service Response:");
Console.WriteLine("-----------------");
Console.WriteLine("{0}", response);
Console.Write("\n\n");
request.Key = "Item1";
asyncResult = client.BeginPutObject(request, null, null);
while ( ! asyncResult.IsCompleted ) {
//
// Do some work here
//
}
try {
response = client.EndPutObject(asyncResult);
}
catch (AmazonS3Exception s3Exception) {
//
// Code to process exception
//
}
Console.WriteLine("Finished Async PutObject operation for {0}.", re
quest.Key );
Console.WriteLine("Service Response:");
Console.WriteLine("-----------------");
Console.WriteLine(response);
Console.Write("\n\n");
request.Key = "Item2";
asyncResult = client.BeginPutObject(request, SimpleCallback, null);
request.Key = "Item3";
asyncResult = client.BeginPutObject(request, CallbackWithClient, cli
ent);
request.Key = "Item4";
asyncResult = client.BeginPutObject(request, CallbackWithState,
new ClientState { Client = client, Start = DateTime.Now } );
Thread.Sleep( TimeSpan.FromSeconds(5) );
}
}
}
Version v2.0.0
23
AWS SDK for .NET Developer Guide
Asynchronous API for .NET 3.5