AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 3.5
 
Gets and sets the property ReceiptHandle.

The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.

Namespace: Amazon.SQS.Model
Assembly: AWSSDK.dll
Version: 0.0.3.0

Syntax

C#
public String ReceiptHandle { get; set; }
Property Value
Type: System.String

Examples

This example shows how to change message visibility.

Change message visibility example

var client = new AmazonSQSClient();

var url = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue";

// Receive messages.
var rcvRequest = new ReceiveMessageRequest
{
  AttributeNames = new List<string>() { "All" },
  QueueUrl = url
};

var rcvResponse = client.ReceiveMessage(rcvRequest);

// Change visibility timeout for each message.
if (rcvResponse.Messages.Count > 0)
{
  foreach (var message in rcvResponse.Messages)
  {
    var visRequest = new ChangeMessageVisibilityRequest
    {
      QueueUrl = url,
      ReceiptHandle = message.ReceiptHandle,
      VisibilityTimeout = (int)TimeSpan.FromMinutes(10).TotalSeconds
    };

    client.ChangeMessageVisibility(visRequest);
  }
}
else
{
  Console.WriteLine("No messages to change visibility for.");
}
      

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8

.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8