title: Get Subject from header
body: <pre><code>Google.Apis.Gmail.v1.UsersResource.MessagesResource.GetRequest header = new UsersResource.MessagesResource.GetRequest(service, userId, messageId);
  
  header.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Metadata;
  
  header.MetadataHeaders = "Subject";
  </code></pre>
  
  <p>That is what I have so far and all I am looking to do is return the subject line. I have been messing with it for awhile and think that is fine but cannot find anything on the next step to just get it.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>OK just in case someone else needs the help, the completed code worked out like this:</p>
  
  <pre><code>          Google.Apis.Gmail.v1.UsersResource.MessagesResource.GetRequest header = new UsersResource.MessagesResource.GetRequest(service, userId, messageId);
        header.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Metadata;
        header.MetadataHeaders = new[] {"Subject", "From", "Date"};
  
        Message Response = header.Execute();
        var reqFrom = Response.Payload.Headers.SingleOrDefault(h =&gt; h.Name == "From");
        var reqDate = Response.Payload.Headers.SingleOrDefault(h =&gt; h.Name == "Date");
        var reqSubject = Response.Payload.Headers.SingleOrDefault(h =&gt; h.Name == "Subject");
        var reqReturn = Response.Payload.Headers.SingleOrDefault(h =&gt; h.Name == "Return-Path");
  
        string from = reqFrom.Value; 
        string date = reqDate.Value;
        string subject = reqSubject.Value;
        string returnEmail = reqReturn.Value; 
  </code></pre>