Taurib
Taurib

Reputation: 461

Sharepoint SiteUserInfoList get all keys and values

I need to get all key and value pairs from Sharepoint 2013 SiteUserInfoList list.

I currently have following code:

            SPWeb web = new SPSite("http://sp2013:2013/_catalogs/users/detail.aspx").OpenWeb();
            SPList item = web.SiteUserInfoList;

            foreach (SPListItem f in item.Items)
            {
                foreach (var it in f.Fields)
                {
                    // Here I would like to print out key value pairs
                    Console.WriteLine("Tile: {0}:{1}", it, it.ToString());
                }
            }
            Console.ReadLine();

Upvotes: 0

Views: 1658

Answers (1)

Piyush
Piyush

Reputation: 826

Use the following:

Console.WriteLine("Tile: {0}:{1}", it.Title, f[it.Title]);

SPFields is a key value collection. To access its value, you need to pass the corresponding key.

Upvotes: 1

Related Questions