webrequest と clientlogin を使用して、新しい分析 API 管理フィードからテーブル ID を取得する必要がある場合。これが私の(簡単な)コードです(ベンゲルに感謝します):
string queryString = String.Format("https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&Email={0}&Passwd={1}&service=analytics&source={2}", __username, __pass, "yourlog");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(queryString);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string responseContent = new StreamReader(response.GetResponseStream()).ReadToEnd();
string authCode = responseContent.Substring(responseContent.LastIndexOf("Auth=") + 5);
queryString = "https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles";
request = (HttpWebRequest)WebRequest.Create(queryString);
request.Headers.Add("Authorization", String.Format("GoogleLogin auth={0}", authCode));
response = (HttpWebResponse)request.GetResponse();
XDocument doc = XDocument.Load(new StreamReader(response.GetResponseStream()));
var entries = (from item in doc.Root.Elements("{http://www.w3.org/2005/Atom}entry")
select new
{
tableid = item.Elements("{http://schemas.google.com/analytics/2009}property").ElementAt(4).Attribute("value").Value,
profileid = item.Elements("{http://schemas.google.com/analytics/2009}property").ElementAt(1).Attribute("value").Value
});