EsrefDurna / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Keep Getting Unauthorized for Google Groups API #604

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem? See the code below.

What is the expected output? A list of recently updated groups. 
What do you see instead?  Error as described below.

Please use labels and text to provide additional information.

1. GroupsService groupService = new 
GroupsService("companyname","GoogleGroupSyncApp");

2. groupService.Credentials = new GDataCredentials(AdminUserId, AdminPwd);

3. DateTime startTime = DateTime.Now.AddMonths(-5);

4. GroupsQuery query = new 
GroupsQuery(GroupsQuery.CreateGroupsUri((AdminUserId)));

5. query.StartDate = startTime;

6. AtomFeed membersFeed = groupService.Query(query);

7. foreach (AtomEntry feed in membersFeed.Entries)
                {
                    Console.WriteLine(feed.....);

                }
Line 6 is resulting in error with a message 

Execution of request failed: 
https://www.google.com/m8/feeds/groups/admin@mycompany.com/full?updated-min=2012
-01-27T15:22:45-05:00.  

The inner exception reads "The remote server returned an error: (401) 
Unauthorized."

With the same admin credentials I am able to perform the following without any 
errors.

 service = new AppsService("mycompany.com", AdminUserId, AdminPwd);

1. GroupFeed groups = service.Groups.RetrieveAllGroups();

2. AppsExtendedEntry entry = 
service.Groups.RetrieveGroup("QBDGtest-Italy@mycompany.com");

Could some one suggest what could be wrong?

Note: Mycompany is just used here for posting purpose only.  The user is a 
super user.

Original issue reported on code.google.com by mbenoyve...@enterasys.com on 27 Jun 2012 at 7:30

GoogleCodeExporter commented 8 years ago
My intention is to get all Groups in our organization that have been updated 
with in a specified time frame.  Get the group members and sync that data with 
our internal Active Directory Groups.

FYI.  We moved all our users from Exchange to Google.

Original comment by mbenoyve...@enterasys.com on 27 Jun 2012 at 7:38

GoogleCodeExporter commented 8 years ago
The GroupsQuery class is part of the Contacts API 
(https://developers.google.com/google-apps/contacts/v3/) and not the 
Provisioning API (https://developers.google.com/google-apps/provisioning/), so 
it is expected that the query fails.

The documentation lists all the methods to manage groups: 
https://developers.google.com/google-apps/provisioning/#methods_for_groups

Original comment by ccherub...@google.com on 10 Jul 2012 at 8:05