Analytics Getting a list of profiles

Getting a list of profiles

A web property may have one ore more profiles (or none at all). You can list all profiles that you have access as:

foreach (AnalyticsProfile profile in analytics.GetProfiles().Items) {
    string profileId = profile.Id;
    string profileName = profile.Name;
}

All profiles for a given Analytics account as:

foreach (AnalyticsProfile profile in analytics.GetProfiles(accountId).Items) {
    string profileId = profile.Id;
    string profileName = profile.Name;
}

Or for a specific web property as:

foreach (AnalyticsProfile profile in analytics.GetProfiles(accountId, webPropertyId).Items) {
    string profileId = profile.Id;
    string profileName = profile.Name;
}