Closed hmendezm closed 6 years ago
Hey @hmendezm,
People filed expand should work just fine:
pnp.sp.web.lists.getByTitle(_spPageContextInfo.listTitle)
.items.getById(1)
.select('Author/Id,Author/Title,Author/Name,Author/EMail')
.expand('Author')
.get().then(console.log)
Please check response message in network tab:
Some of the fields provided in select
probably do not exist.
Thanks Koltyakov for your reply and time,
As I mentioned in my original port. If I remove .expand("Names") and all references to the "Names" field in the .select, I do not get errors. so this means the rest of the fields are ok. also I verify the fields exist in two ways the script above and by make restfull call in the browser. I know .expand works. It just is not working for this specific custom list and this is a simple list with two people fields and basic fields. Nothing special. Actual I tried with Author ("Created BY") field and I got the same problem.
Hm... corrupted list... What is in the error message exactly? I mean not the error "ProcessHttpClientResponseException: Error making HttpClient request in queryable: [400] Bad Request"
but the message in response (as shown in the screenshot above).
Hi This is the error msg. It looks like the Names filed is not valid although the field is in the list.
{
"error": {
"code": "-1, Microsoft.SharePoint.SPException",
"message": {
"lang": "en-US",
"value": "The query to field 'Names' is not valid. The $select query string must specify the target fields and the $expand query string must contains Names."
}
}
}
Hm... such message usually shows up when select
doesn't contain any props from the expanded field or there is no expand
by a field when props are in the select
. But staring at your initial sample I can't see a reason to cause this exception. Which leads me to the idea of "something wrong with the list" rather than with the lib or a mistake in a code...
Ok. I think I found the problem. the problem is the data of the field. There are items where the user is System Account and this does not have all properties. is a way to filter all item where the properties that I need are not present eg. UserName, email, Title?
Thanks for you help
i had a similar issue recently. i have a list with a user field, and a test account with no email.
if i make a rest call to get the list items and expand the user field, and request the user/email, i get an invalid request if it has the test user. Without the test user it works fine.
the test user is an account that is sunched from our local ad
Sent from my iPad
On Apr 5, 2018, at 5:42 PM, H. Mendez notifications@github.com wrote:
Ok. I think I found the problem. the problem is the data of the field. There are items where the user is System Account and this does not have all properties. is a way to filter all item where the properties that I need are not present eg. UserName, email, Title?
Thanks for you help
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Going to close this as answered, please reopen should you need to continue the conversation or the question isn't resolved. Thanks!
Category
[ ] Enhancement
[ ] Bug
[X] Question
Version
Please specify what version of the library you are using: [ v3.0.5 ]
Expected / Desired Behavior / Question
I need to expand a field Sp.FieldUser (people field) to get title and email. The problem is when I use the .expand("Names") where Names is the field name , I get the error "ProcessHttpClientResponseException: Error making HttpClient request in queryable: [400] Bad Request"
I thought that the error was the field name but when I run the code below I get the name of the field in the list. This means I get the correct name. If I remove .expand and remove Names/title and Names/Email I do not get errors. Do you have any idea what can be the issue?