Cree una lista de contactos con la lista de información del usuario
-
28-09-2020 - |
Pregunta
Quiero rellenar una lista en la Fundación SharePoint 2013 con la lista de información de usuario.La lista de información del usuario se encuentra en /_catalogs/users/simple.aspx (SiteUserinFolist) y contiene todas las entradas de los usuarios.
¿Alguna idea de cómo hacer esto?
Solución
Otros consejos
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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a sharepoint.stackexchange