There is a nice function with WSS that will retrieve the user
information from AD when adding them to a new site. It will also
retrieve their email address and put it into the userInfo table.
But when they are not explicitly added to a site their email address
is never retrieved from active directory. In fact their user
information is not even put into userInfo until they visit the site.
This is a problem for me because I have code that will automatically
add alerts for specific people in a team site. If they have not
been to the site then there is no user to add an alert to, and if
they have been to the site but have not been added to a site
explicitly or have not manually entered their email address, the
alert never reaches them.
When I add the alerts I can check to see if a user is in the site
and add them if necessary using SPUserInfo, but then I have to also
add code to get the correct email address etc.
What object model methods are out there that will let me do what WSS
does when you add a user to a site and automatically get their email
address etc.? Basically I need something that given a login name it
will add the user to userInfo from active directory information.