GetAttributes() public method

Returns all of the attributes associated with the specified item. Optionally, the attributes returned can be limited to one or more attributes by specifying an attribute name parameter.

If the item does not exist on the replica that was accessed for this operation, an empty set is returned. The system does not return an error as it cannot guarantee the item does not exist on other replicas.

/// The value for a parameter is invalid. /// /// The request must contain the specified missing parameter. /// /// The specified domain does not exist. ///
public GetAttributes ( GetAttributesRequest request ) : GetAttributesResponse
request GetAttributesRequest Container for the necessary parameters to execute the GetAttributes service method.
return GetAttributesResponse
        public static NewsComponents GetNewsItem(string domainName, string itemName, AmazonSimpleDBClient sdbClient)
        {
            NewsComponents newsItem = new NewsComponents();

            GetAttributesRequest getAttributeRequest = new GetAttributesRequest()
                      .WithDomainName(domainName)
                      .WithItemName(itemName);
            GetAttributesResponse getAttributeResponse = sdbClient.GetAttributes(getAttributeRequest);
            List<Amazon.SimpleDB.Model.Attribute> attrs = null;
            if (getAttributeResponse.IsSetGetAttributesResult())
            {
                attrs = getAttributeResponse.GetAttributesResult.Attribute;
                int i = 0;
                foreach (Amazon.SimpleDB.Model.Attribute attribute in attrs)
                {

                    if (attribute.IsSetName())
                    {
                        string name = attribute.Name;
                    }
                    if (attribute.IsSetValue())
                    {
                        switch (i)
                        {
                            case 0:
                                newsItem.NewsID = Guid.Parse(attribute.Value);
                                break;
                            case 1:
                                newsItem.Source = attribute.Value;
                                break;
                            case 2:
                                newsItem.Section = attribute.Value;
                                break;
                            case 3:
                                newsItem.NewsItem = attribute.Value;
                                break;
                            case 4:
                                newsItem.NewsHeadline = attribute.Value;
                                break;
                            case 5:
                                newsItem.NewsAdded = Convert.ToDateTime(attribute.Value);
                                break;
                            case 7:
                                newsItem.Summary = attribute.Value;
                                break;
                            case 8:
                                newsItem.Category = attribute.Value;
                                break;
                        }
                        i++;
                    }
                }
            }
            return newsItem;
        }