Google Groups: Retrieve list of groups for a user - google-groups

Is there an API to get the list of all Google groups a user is part of (of course, with his/her permission) and vice versa (given a Google group, get all users part of that group).

The Google Apps Provisioning API lets you retrieve the current memberships for a Google Apps user as well as list all members of a Google Apps Google Group. However, there is no way to do this for consumer (#gmail.com) Google Accounts and regular (#googlegroups.com) Google Groups.

Also it need not be Google Apps Provisioning. They also have gdata Services and retrieve Groups function. For example
if you have an user example#domain.com, then you can use RetrieveGroups(String memberId, bool directOnly) where memberId is the email address and directOnly must be set to True. This works sleek.

Related

REST API to get a list of active subscriptions in Google Workspace

Looking for an API to get list of all subscriptions in Google workspace (not the detailed info about available licenses count etc). It's the same information which is available on Admin console under Billing-> Subscriptions
Billing/Subscriptions
If you're a reseller
You can use subscriptions.list The list can be all subscriptions, all of a customer's subscriptions, or all of a customer's transferable subscriptions.
If you're a regular Google Workspace customer
You can use licenseAssignment.list. It doesn't display the list itself, but you can filter the elements within the items property and loop over productId, skuID and skuName

Yammer API get list of all users in All Company

https://www.yammer.com/api/v1/users/ does not work and only gives me users in the current user’s Yammer network. I need every single user.
If All Company had an ID I could use https://www.yammer.com/api/v1/users/in_group/
Moreover, https://www.yammer.com/api/v1/groups does not seem to have All Company within it
On the backend, All Company is not actually a group. It behaves kind of like a group in the UI, but with notable difference like users not being able to leave All Company. This and other difference betray the fact that the Yammer backend does not in fact treat All Company as a normal group.
Hitting the users.json endpoint will give you data about all users in the users' current network. This list of users is the same as the list of users who are "members" of the All Company group for that network.

Transition from yahoo groups to google groups

A yahoo group I'm in is preparing for the possibility of yahoo's demise.
They are investigating the transition to google groups.
We do not want to give up either backlog or attribution of the 13,000 some posts.
Is there a way to transfer information, including users of individual posts from yahoo groups to google groups.
Alternately, is it possible from Yahoo groups to something like phpBB.
I am posting this in both Stack Exchange and in Google products forum.
While the question is an old one, others may be interested to know that using the Google Groups Migration API it is possible to upload the users and the data from Yahoo Groups.
Sequence:
Download your Yahoo Group data using Personal Groupware http://www.personalgroupware.com
Export the the data into your chosen database (e.g. MySql)
Upload the data using the Google Groups Migration API
https://developers.google.com/admin-sdk/groups-migration/v1/get-start/getting-started
You will not be able to transfer your group to Google.
The upload of group data follows this pattern:
Upload Users
Upload Subjects
Upload Replies
You will be stuck at 1) as you are unable to create the list of users on Google. You do not have write access to the Google user database.
For phpbb this will definitely be possible as you have full control of the database.

How to determine if users with different home domains are part of same google apps org?

In Google Apps, there is always a base/primary organization. But Google Apps can have subdomains and suborganizations both (or combination of those).
We want to be able to identify the currently logged-in user as being part of the overall organization, whether it be the primary org/domain or some subdomain or suborg. But when you get user info or license info, it returns the home domain of the currently logged in user as the ID for their organization. No ID is consistent across all subdomains or suborgs.
I've also tried listing all orgs using the organization apis, but that doesn't seem to work when trying to get the org info of the root org: https://developers.google.com/admin-sdk/directory/v1/guides/manage-org-units
Is there a way, given a particular Google Apps user, to determine what the primary organization is?
The only alternative we have is to treat every domain/subdomain in the Google Apps org as it's own independent org. This is less than ideal because now a Google Apps admin who manages all of their sub-orgs/subdomains in one place in Google will now have to manage a separate organization in our app for each domain in their overall org. This uses up extra resources in our system for creating these additional orgs, but more importantly creates a very confusing organization/user management model.
When you look at the Users resource for the two users, compare the customerId attribute. If they match, the two users are in the same Google Apps account. If they don't they're not.
Also, don't assume two logged in users are in the same Apps account. One could be an Apps account and one could be a consumer account even though they have the same SMTP domain.

Get all email addresses of user using Google API

For my own gmail account, I have multiple email addresses associated with it. For example, I have an email address from my university that is associated with my gmail, and I can send emails from my gmail as if they are coming from my university email address.
I'm reading up on the Google APIs, and I see that I can get a user's gmail address, but can I also get any other email address that is associated with their gmail account?
When a user logs in to my site, I'd like to present them with a list of the gmail-associated email addresses and let them select the one they would like to use.
EDIT: Thanks everyone for the answers, but I don't think any of them answers the question. I've been playing with Google's OAuth playground. It is strange that I can get lots of very personal information (a list of a user's contacts and even received emails) but I can't get the user's alternative email addresses.
Your description is a little vague. Are you talking about send-as alias accounts or alternate email accounts?
Send-as Alias
Either way, you can interact with the send-as accounts here: Manage Send-as Alias
Alternate Emails via Admin SDK
As for alternate email accounts, they can be accessed via:
Admin SDK: https://developers.google.com/admin-sdk/directory/v1/guides/manage-user-aliases?hl=en
Google Apps Script: https://developers.google.com/apps-script/reference/gmail/gmail-app#getAliases()
Additional info here on how the accounts work.
Email addresses associated with your account
Alternate email addresses and other Google products
Connect other email accounts to your Google Account
Federated Login
Also, I'm not exactly sure how you are trying to incorporate this functionality into your site but another area I recommend checking out is Federated Login for Google Account Users. This might also provide you with the functionality you seek.
Using federated login (also known as federated identity), your website
or application can allow visitors to sign in using their Google user
accounts. Federated login frees users from having to set up separate
login accounts for different websites, and frees you from the task of
implementing login authentication measures.
It has been a while since the question was asked. You can use the Google People API to get a user's primary email address and aliases. Here's the documentation. The scope you need to use is: https://www.googleapis.com/auth/user.addresses.read
This will return all the email addresses for the user and also tell you which is the primary one.
If you use OAuth to have your users sign-in with their Google accounts (with or without G+) the user will be prompted (by Google) to select which of their accounts they wish to authorize your application to use:
https://developers.google.com/accounts/docs/OAuth2Login
So to directly answer your question, I'm not aware of an API to return that list of users - however you shouldn't need to, Google will take care of this before returning to your application.
If your user is already logged in, and you wish to give them the ability to change the Google account they are using, I believe it is possible to prompt them again to select the account they are interested in (search for select_account on the link above).
This is possible. However, this has changed since Google announced the deprecation of their Google+ People API, which a lot of folks used to get all the email addresses for a user. The current most voted answer now goes to a 404.
Google Plus People API Replacement
Google has replaced the Google Plus People API /plus/v1/people/me with https://developers.google.com/people/ and you’ll want to use the https://www.googleapis.com/auth/user.emails.read profile scope as discussed here as a replacement. The schema is different, so you'll need to change your mapping as well.
If your app already used the following scopes from the old /plus/v1/people/me your user will not have to re-consent when you switch to the new API:
email
profile
https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/plus.me
https://www.googleapis.com/auth/plus.profile.agerange.read
https://www.googleapis.com/auth/plus.profile.emails.read
https://www.googleapis.com/auth/plus.profile.language.read