So here is the deal:
You add a user to the users collection of a site collection by calling into the SPUserCollection.Add method passing login name, email, name and notes as parameters, but notes field doesn’t get populated as you expected:
[CSharp]
using (SPSite site = new SPSite(url))
{
using (SPWeb sweb = site.OpenWeb())
{
//Ommitted Code for brevity
sweb.SiteUsers.Add(“foo\\JohnDoe”, “JohnDoe@foo.com”, “John Doe”, “Is it John Doe or John Dough?”);
//Ommitted Code for brevity
}
}
[/CSharp]
Although, using the code snippet above, the user is added correctly to the user collection of the site but notes field is always left blank. Note that in the above code, I am just adding the user to the users collection and I don’t bother adding him to any specific group at this point (for example by calling into SPWeb.Groups[groupName].AddUser). Let’s suppose that my requirement only dictates to add the user to this collection at this point and that’s all for now.
kept at each site collection level, there is this hidden list called ‘User Information List’ that stores some metadata about every and each user has ever browsed, authenticated or added to a group in that site collection . This design decision along with many other things kept at the site collection level gives countless developers a good amount of grief and frustration as you may be aware of . When a user is granted access to a site, a new list item will be created in that list. The User Information List can be accessed via the browser by navigating to /_catalogs/users/simple.aspx from your site or via Object model , only if you or your code runs under sufficient privileges. So, we can use that list for troubleshooting above issue by updating the ‘Notes’ field after the user is added. The following example shows how to interact with this list for setting the required user properties.
[CSharp]
using (SPSite site = new SPSite(url))
{
using (SPWeb sweb = site.OpenWeb())
{
//Ommitted Code for brevity
sweb.SiteUsers.Add(“foo\\JohnDoe”, “JohnDoe@foo.com”, “John Doe”,string.Empty);
user = sweb.AllUsers[“foo\\JohnDoe”];
SPList list = sweb.Lists[“User Information List”];
SPListItem userItem = list.Items.GetItemById(user.ID);
userItem[“Notes”] = “Is it John Doe or John Dough?”;
userItem.Update();
//Ommitted Code for brevity
}
}
[/CSharp]
This way you pass an empty string to the calling method (SiteUsers.Add) and update the Notes field in a separate call.
I was humbled when Stephen Ibaraki asked me if we could have a chat over the phone about myself, collaboration and SharePoint. It really was a fun experience and I enjoyed talking to him and sharing some pointers. To listen to the interview, click on this MP3 file link.
More about this interview on Canadian IT Manager’s blog.
I’ve finally gotten off my derriere and put together a tripled-boot system featuring Windows Vista (x64), Linux Fedora (i686) and Windows 2008 with Hyper-V on my Lenovo T61p laptop (I chose i686 CPU architecture for my Linux OS because 32 bit and 64 bit story is a little bit different in Linux than Windows!).
The fact that how much I am loving my Linux AdventureWorks (meaning my adventures in Linux land) and how great this OS is , remains to be discussed in another post (oh , Yeah! 😉 ), but believe or not, the hardest part of the whole triple boot story was to set up the wireless adapter in Windows 2008!
The same driver (Intel(R) Wireless WiFi Link 4965AGN) which was working rock solid in vista was giving me hard time in Windows 2008! Actually , in the device manager everything looked like just fine (this device is working properly message) , but I was not able to find any wireless network to connect to! Feeling isolated…..
I was getting “Your wireless adaptor is experiencing driver issue” when I ran Windows native diagnosis tool and Intel manual Diagnosis software was yelling that the “wireless adapter is disabled or uninstalled” or the installed version of the driver is not supported by my Wireless chipset or something like that! I tried all three drivers in the lenovo support Web site, but nothing changed and the problem still as it was!
Reset the WINSOCK entries, IPv4 and IPV6 TCP/IP stack to installation defaults and rebooted the computer , no dice!
It finally turned out that there is this Feature in Windows 2008 called “Wireless LAN Service” that needs to be installed, otherwise wireless networks won’t be discovered! Easy , but kept me scratching my head for a while 8)
Most Viewed Posts by the Most Valuable Professionals in 2008.
In parallel to the YouShapeIT engagement , I ran a small survey among my fellow MVPs, simply asking for their most viewed blog post in 2008. Initially I wanted to host this linkfest as part of a separate bulletin somewhere in this month’s YouShapeIT issue (i.e. in community section) , but due to some issues, this was not possible.
Here is the linkfest to the most viewed post by the most valuable professionals in SharePoint Space (In no special order):
- Eli Ribbolard
- Paul Stork
- Spence Harbar
- Darrin Bishop
- Robert L. Bogue
- Ágnes Molnár
- Sezai komur
- Tobias Zimmergren
- Gary Lapointe
- Ishai Sagi
- Andrew Woodward
- Jake Dan Attis
- Paul Galvin
- Chris O’Brien
- Nikander & Margriet Bruggeman
- Reza Alirezaei
Honestly, I don’t think I have time to update this page , but I will turn on the comments in case any SharePoint MVP or non-MVP wants to leave their most viewed post here as well. I think this is a good list for those who are interested to simply read the best !
Cheers,
This month I had the opportunity to help the editorial team of the Microsoft’s YouShapeIT online magazine to prepare their issue.
YouShapeIT provides a one-stop portal for all the best information so that an IT Pro doesn’t have to go hunting all over the internet and Microsoft for the best resources. I’m told that their site has target audience of 26 million and specifically in the category of IT management (small “m” here or really infrastructure).
The theme this month is Collaboration and the focus is on connecting people, processes, and information using SharePoint products and technologies. As you may notice the purpose of the site is to cut through the clutter and point out the best sources of information.