title: Getting Object tag value in AWS S3
body: <p>I am using scala to get information about my objects that are in S3 I am intersted in getting each object I have inside S3 Bucket his tag value so far I have accomplished this code to get me information about my objects but did not succeeded in getting its tagging value: I used this code in scala:</p>
  
  <pre><code>def retrieveObjectTags(keyName: String): Unit ={
  
      try {
        println("Listing objects")
        val req: ListObjectsV2Request =
          new ListObjectsV2Request().withBucketName(bucketName).withMaxKeys(2)
        var result: ListObjectsV2Result = null
        do {
  
  
          result = client.listObjectsV2(req)
          for (objectSummary &lt;- result.getObjectSummaries) {
            println(
              " - " + objectSummary.getKey + "  " + "(size = " + objectSummary.getSize +
                ")")
  
            println(objectSummary.getETag)
  
          }
  
          println("Next Continuation Token : " + result.getNextContinuationToken)
          req.setContinuationToken(result.getNextContinuationToken)
        } while (result.isTruncated == true);
    }catch {
        case ase: AmazonServiceException =&gt; {
          println(
            "Caught an AmazonServiceException, " + "which means your request made it " +
              "to Amazon S3, but was rejected with an error response " +
              "for some reason.")
          println("Error Message:    " + ase.getMessage)
          println("HTTP Status Code: " + ase.getStatusCode)
          println("AWS Error Code:   " + ase.getErrorCode)
          println("Error Type:       " + ase.getErrorType)
          println("Request ID:       " + ase.getRequestId)
        }
  
        case ace: AmazonClientException =&gt; {
          println(
            "Caught an AmazonClientException, " + "which means the client encountered " +
              "an internal error while trying to communicate" +
              " with S3, " +
              "such as not being able to access the network.")
          println("Error Message: " + ace.getMessage)
        }
  
      }
  
  //    val getTaggingRequest = new GetObjectTaggingRequest(bucketName,keyName)
  //    var getTagResult = client.getObjectTagging(getTaggingRequest)
  
      //println(getTaggingRequest)
      var tag: Tag = new Tag()
      println("tag name:" + tag.getValue)
  
    }
  </code></pre>
  
  <p>as for the remarked lines I have encounter a problem with it, what other way I can use to solve this problem?</p>