public string RetrieveOU(AppsService UserService, string OuPath)
{
var Token = UserService.Groups.QueryClientLoginToken();
var OUService = new Dgc.GoogleAppService();
var CustId = OUService.GetCustomerId(UserService);
var uri = new Uri("https://apps-apis.google.com/a/feeds/orgunit/2.0/" + CustId + "/"+OuPath);
WebRequest WebRequest = WebRequest.Create(uri);
WebRequest.Method = "GET";
WebRequest.ContentType = "application/atom+xml; charset=UTF-8";
WebRequest.Headers.Add("Authorization: GoogleLogin auth=" + Token);
WebResponse WebResponse = WebRequest.GetResponse();
if (WebResponse == null)
{
throw new Exception("WebResponse is null");
}
StreamReader SR = new StreamReader(WebResponse.GetResponseStream());
var _Result = SR.ReadToEnd().Trim();
return _Result;
}