title: Can I read messages from gmail using gmail api and c#?
body: <p><br/>
  I want read all messages in my gmail account using c# and gmail api.<br/>
  Can I do this?<br/>
  I read a lot of articles in <a href="https://developers.google.com/gmail/api/" rel="nofollow">Gmail API</a>, but i couldn't read messages.<br/>
  Also I want to read a body of messages or header. <br/>
  I will be very glad if someone can help me :)</p>
  
  <p>I use this code snippet:</p>
  
  <pre><code>public static List&lt;Message&gt; ListMessages(GmailService service, String userId)
      {
          List&lt;Message&gt; result = new List&lt;Message&gt;();
          UsersResource.MessagesResource.ListRequest request = service.Users.Messages.List(userId);
  
          do
          {
              try
              {
                  ListMessagesResponse response = request.Execute();
                  result.AddRange(response.Messages);
                  request.PageToken = response.NextPageToken;
              }
              catch (Exception e)
              {
                  Console.WriteLine("An error occurred: " + e.Message);
              }
          } while (!String.IsNullOrEmpty(request.PageToken));
  
          return result;
      }
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>foreach (var item in ListMessages(service,"me"))
                  MessageBox.Show(item.Snippet);
  </code></pre>
  
  <p>But in a result I have empty message box.</p>