Hi David,
I use .NET client library version 1.2.2.0 and there is constant
AppsException.UserDeletedRecently defined, which is returned as error
code, when user was deleted recently i.e. 5 days has not passed yet
from the day the user was deleted. You can use it to distinguish this
situation from one, where user already exists (error constant
AppsException.EntityExists is returned). I do it this way, have tested
it and it works.
Btw...you can also retrieve all accounts quite fast. Our organization
(also college) has 10.700 Google users currently. I am able to
retrieve information about all these users in 40 seconds, which is not
that bad compared to standard functions available in .NET client
library. The trick is multi-threading. You retrieve multiple pages of
users concurrently. Here is how to do it in case you are interested:
1) Sort all Google users in your table by name exactly the same way
Google uses when you retrieve users page by page.
2) Loop through the sorted table and remember batches of 95 accounts
and store them e.g. in separate DataTables.
3) For each 95-row DataTable start new thread, which retrieves the
page of accounts starting from username equal to username contained in
first row of 95-row DataTable.
4) Compare retrieved entries with rows in table and decide if user was
created/updated/deleted manually in Google and make appropriate
changes to you user table.
Note that:
- You must retrieve all users from your table into big client's in-
memory DataTable before spawning number of worker threads, otherwise
you will not be able to update the table in threads because of DB
locks placed on table by your SELECT SQL statement.
- You need to control maximum amount of currently running worker
threads. Do not start new threads, when current number of running
worker threads is greater than e.g. 15 threads (i.e. 15 connections to
Google server).
- You need to allow multiple concurrent connections to Google server.
Default concurrent connection limit is set to 2 in .NET. You can do it
by setting ServicePointManager.DefaultConnectionLimit to value equal
to number of maximum allowed number of concurrently running threads or
set it in your app.config file e.g.:
<system.net>
<connectionManagement>
<add address = "*" maxconnection = "15" />
</connectionManagement>
</system.net>
- You must properly handle cases, where e.g. a lot of new accounts
were added in one page or allot of accounts were deleted. In first
case, you need to retrieve next pages from Google in worker thread,
until you encounter user-name, equal to or greater than starting user-
name of next worker thread. In second case, you need to end the worker
thread, if you encounter user-name in your table, which is equal to or
greater than the starting user-name of next worker thread.
Regards,
Jiri
On Sep 19, 3:50 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've been reading what I could find in the discussions on deleted
> accounts and unfortunately it hasn't quite covered the problem I've
> got.
>
> Because of the number of accounts we have here at the college, some
> 11,500, it's not really practical for us to obtain the list of current
> user accounts via the API and compare it with our list of students in
> order to decide what accounts need to be created or deleted. So
> instead we have created a kind of google state table in our system to
> list students that we have created on the google email system. New
> accounts are added to this table and deleted accounts are removed from
> this table, simple enough.
>
> A problem has occurred where an account has been deleted from google
> and also from our state table as expected. When the student re-
> enrolled and because they were current on our system and not in the
> state table our software attempted to create the google email account,
> so far so good.
>
> Unfortunately it seems that (through the API) the email account still
> exists as I get error code '1300 - Entity Exists' (searching for this
> student in the google email control panel it says it doesn't exist).
> So our system, seeing that it exists then updates the state table to
> indicate that the email account exists in google. It does this to try
> and keep itself up to date in case someone manually created their
> email account for them. So at this point our system believes the
> student has a google email account and will not attempt to create it
> again.
>
> I'm thinking that when the 5 grace days are over after deleting the
> account and it actually does get removed from the google system then
> the API would actually successfully recreate the email account if it
> tried. But this is not going to happen because as I said it now thinks
> the student has a current google email account.
>
> I suppose what I'm getting at is that it is misleading for the API to
> return 1300 - Entity Exists when trying to create an account that is
> in the process of being deleted. Maybe an extra exception error code
> should be made available that indicates what is really happening, such
> as 1304 - Entity Deleted or Entity Awaiting Purge, etc.
>
> Alternatively, couldn't a CreateUser call on an account name being
> deleted actually resurrect the deleted account? I'm assuming here that
> RestoreUser reverses the SuspendUser process and doesn't restore a
> deleted account, correct me if I'm wrong here because the help info
> I've seen on RestoreUser doesn't actually say what it's restoring
> from, suspension or deletion or maybe both, I don't know. If
> RestoreUser does only counter a SuspendUser then what is the procedure
> currently for undeleting an account that has not yet been purged?
>
> Any help on this would be greatly appreciated.
>
> Regards,
> David
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---