Domanda

I have a list called "Employees" where I store an employee's name in the Resource field using the people picker. The people picker allow single values only (no groups). I have other fields (columns) in this Employees List.

Weekly I download this list using the getbytitle/items web API service and I also download the site user information list using _vti_bin/listdata.svc/UserInformationList end point. I download them both for analysis using BI Tools.

The Employees List when downloaded, only shows the ID of the person in the Resource field. This ID is the same ID of the employee in the site's UserInfoList.

In the BI Tools I join the Employees List and the User Information List so I can show info from UserInfo like name, email, dpt, etc.

Due to attrition, when an employee is no longer working for the company, the name of the employee stays in the "Employees" List, but when I download it, it still only shows the ID of the person.

The problem is when I download the UserInfo List, the employee that is no longer working for the company is no longer there, so I can't join them.

However if I go and look at the list using SharePoint web pages, the name of the resource is still displayed.

My question is: Short of storing the employees names in an Excel file, is there a way I can get the deleted or hidden users from the UserInformationList using the web API? I only need the name.

I don't have access to the site collection UserList, I'm only the admin of the site. I tried looking into _catalogs/users/simple.aspx shown here, but only active users show there.

È stato utile?

Soluzione

As you are already using lists/getbytitle()/items endpoint and you are able to get the ID from user column, I will suggest you to use below REST endpoint which will expand the user column and will give you other details like Name, Email, Department, etc.

_api/web/lists/getbytitle('Employees')/items?$select=Title,Resource/Name,Resource/Id&$expand=Resource

Reference:

SharePoint 2013: Get User Details from Person or Group field using REST API

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top