Nevermind... figured it out.

AddOwnerToGroup does not add a new user to the group as an owner. It
upgrades an existing member to owner. This seems counter-intuitive to
me, but at least my code is working.

  service.Groups.AddMemberToGroup(array1[a], group);
  service.Groups.AddOwnerToGroup(array1[a] + "@" + DOMAIN, group);

-Evan Windsor

On Mar 31, 11:09 am, ewindsor <[email protected]> wrote:
> I'm writing a console app in C# using the Provisioning API to update
> gmail distribution lists.
>
> The group naming structure is as follows:
> item.0...@domain (Announcement group)
> sec.item.0...@domain (Announcement group, used as security group)
>
> When I attempt to add the security group to the normal group as an
> owner, the code continues executing with no exception, but the group
> does not get added.
>
> Code Sample:
> try
> {
>   if (array1[a].IndexOf("sec.") != -1)
>   {
>     service.Groups.AddOwnerToGroup(array1[a]+"@"+DOMAIN, group);
>     Console.WriteLine("AddOwner: " + array1[a] + "@" + DOMAIN);
>   }
>   else
>   {
>     service.Groups.AddMemberToGroup(array1[a], group);
>     Console.WriteLine("Add: " + array1[a]);
>   }}
>
> catch (Exception e)
> {
>   Console.WriteLine("Error: Most likely caused by adding a security
> group that doesn't exist.");
>
> }
>
> It adds users with no problem, and only gets the exception when adding
> an owner that is a group that doesn't exist yet (which was my next
> task). I can add these security groups from the web frontend just
> fine, but I'm dealing with thousands of these groups, and manually
> adding them all is not an option.
>
> Anyone else run into a similar problem? Is this a known bug? Is there
> any fix?
>
> -Evan Windsor
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to