I am trying to send via Gmail Api Rest a mail with attachment larger than 5MB. To accomplish that I am trying to sent it with resumable upload. This is my code.
byte[] ba = System.IO.File.ReadAllBytes(uploadFromPath);
String base64String = Convert.ToBase64String(ba);
string url = "https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=resumable"
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
request.Headers.Add("Authorization", "Bearer " + token);
request.Headers.Add("X-Upload-Content-Type", "message/rfc822");
request.Headers["X-Upload-Content-Length"]= base64String.Length.ToString();
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = body.Length;
After I make the request I am getting the location
location = res.Headers["Location"];
and after that I make the PUT request with the location.
I would like to know what should I insert inside first request Body and what should be inside second request. I have seen this post Attaching a file using Resumable upload w/ Gmail API but the code worked only for files smaller than 5MB. Is there anything else I should do to accomplish attchment larger than 5MB?