public JsonResult Index() { IAuthenticator authenticator = Session["authenticator"] as IAuthenticator; AnalyticsService service = new AnalyticsService(new BaseClientService.Initializer() { Authenticator = authenticator }); Profiles profiles = new Profiles(); // profiles = profiles = service.Management.Profiles.List("~all", "~all").Fetch(); JsonResult results = Json(profiles); results.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return results; }
private string[] HandleGetProfiles(Profiles profiles, string profilename) { if (profiles == null) { AddLog("GetProfiles [Profiles are null]", true, -1); return null; } string[] a = new string[profiles.Items.Count]; for (int i = 0; i < profiles.Items.Count; i++) { if (profilename.Length > 0 && profilename != profiles.Items[i].Name) continue; int aid = DBModule.GaGetAccountID(profiles.Items[i].AccountId); if (aid != 0) { int id = DBModule.GaAddProfile(profiles.Items[i].Name, profiles.Items[i].Kind, profiles.Items[i].SelfLink, profiles.Items[i].Id, profiles.Items[i].WebPropertyId, profiles.Items[i].Currency, aid, SyncManager.CurExecProject.DbId); if (id != null) a[i] = profiles.Items[i].Id + "=" + id.ToString(); } } return a; }