0

I want to populate a list in sharepoint 2013 foundation with the user information list. The user information list is found at /_catalogs/users/simple.aspx (SiteUserInfoList) and contains all the entries of the users.

Any idea about how to do this?

0

You can use server object model in a console based application or a Timer job. Get all the values from users list

Check this this for details.

Then you can add items in your destination list using C#. Code is presented here

  • Thanks for your answer, but that leads to another problem. Sharepoint is installed on a server. Visual studio is installed on my computer. It looks like i need to have sharepoint installed on the same computer as the visual studio is installed to create sharepoint projects in visual studio... Any way around this? – Koiski Jun 13 '14 at 8:40
  • You should install Visual Studio on the server to Code something. But Still you can use C# Client Object Model to code on your Computer. Please check this( codeproject.com/Articles/399156/…) – Varun Verma Jun 13 '14 at 9:15
0

The url provided is basically a oob list that contains all the user information. That means you can fetch an instance of it and perform normal list operations with it.

If using server object model, this is the code I lifted from Code Project and modified.

SPUser sUser = myweb.CurrentUser;
SPList UserList = SPContext.Current.Web.SiteUserInfoList;

SPList targetList = SPContext.Current.Web.Lists["target"];

foreach(SPListItem item in UserList.Items.GetItems()) 
{
  var newItem = targetList.Items.Add();
  newItem["UserName"] = item.Name;
  //populate column values;
  newItem.Update();
}

If you want to use different object model then there is comphrensive guide to working with list and list items using different object models : Here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.