Message message = service.Users.Messages.Get(userId, messageId).Execute(); IList<MessagePart> parts = message.Payload.Parts; foreach (MessagePart p in parts) { // Console.WriteLine("Boooo"); if (p.Filename!=null && p.Filename.Length>0) { if (p.MimeType == "image/jpeg") { MessagePartBody dd = message.Payload.Body; // Here , I want to get images from message body. } // Console.WriteLine("Poooo "); String attId = p.Body.AttachmentId; if (attId != null) { MessagePartBody attachPart = service.Users.Messages.Attachments.Get(userId, messageId, attId).Execute(); byte[] data = FromBase64ForUrlString(attachPart.Data); string decodedString = Encoding.UTF8.GetString(data); File.WriteAllBytes(Path.Combine(outputdir, p.Filename), data); // Console.WriteLine("Coooo"); // Console.WriteLine(decodedString); } } } Console.WriteLine(message.Snippet + " " + message.SizeEstimate);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)