我正在尝试使用C#Http请求来更新我的Gmail帐户的签名,我正在尝试重新创建Http调用,如此Gmail测试页https://developers.google.com/gmail/api/v1/reference/users/settings/sendAs/update所示,但由于某种原因, “responseString”变量返回“未找到”
var client = new System.Net.Http.HttpClient();
var userId = "my_email@gmail.com";
var sendAsEmail = "my_email@gmail.com";
var OAuthKey = "xxx-xxx.apps.googleusercontent.com";
var js = new JsonSerializer();
var payload = new {signature = "Regards<br/>Joe Bloggs"};
var json = js.Serialize(payload);
var content = new StringContent(json, Encoding.Default, "message/rfc822");
var response = await client.PostAsync("https://content.googleapis.com/gmail/v1/users/"+userId+"/settings/sendAs/"+sendAsEmail+"?alt=json&key=" + OAuthKey, content);
var responseString = await response.Content.ReadAsStringAsync();