Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting [object Object] when trying to display a Person or Group field using PnP #1078

Closed
3 tasks
astatke opened this issue Feb 27, 2020 · 3 comments
Closed
3 tasks

Comments

@astatke
Copy link

astatke commented Feb 27, 2020

Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your
needs please complete the below template to ensure we have the details to help. Thanks!

Please check out the Docs to see if your question is already addressed there. This will help us ensure our documentation covers the most frequent questions.

Category

  • Enhancement
  • Bug
  • [x ] Question
  • Documentation gap/issue

Version

Please specify what version of the library you are using: [ ]

Please specify what version(s) of SharePoint you are targeting: [ SP 2016 ]

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

If you are reporting an issue please describe the expected behavior. If you are suggesting an enhancement please
describe thoroughly the enhancement, how it can be achieved, and expected benefit. If you are asking a question, ask away!

Observed Behavior

If you are reporting an issue please describe the behavior you expected to occur when performing the action. If you are making a
suggestion or asking a question delete this section.

Steps to Reproduce

If you are reporting an issue please describe the steps to reproduce the bug in sufficient detail to allow testing. If you are making
a suggestion or asking a question delete this section.

Submission Guidelines

I am using PnP to display a list time in my SP 2016 on-premise for a list that has a column called ServiceContact with People or Group type. I can easily display all fields but not ServiceContact. I have limited JS skill and is wondering if you could help. Attached find a screenshot of my REST API call displayed in ATOMS. I also attached my JS code file.
2-MyServices html-code
1-rest-api-atoms

@PathToSharePoint
Copy link
Contributor

You are not using expand correctly, see the documentation. Your query should look like this:

$pnp.sp.web.lists.getByTitle("ListName")
.items
.select(...)
.expand(...)
.get()

@koltyakov
Copy link
Member

Not related to the library actually. Generic JS dev question. We encourage asking such in community forums or Gitter channel.
To reach a property as in any JS code you should provide a path to the prop, e.g. result[i].ServiceContact.EMail with all corresponding validations and checks. Regarding library-specific, I'd say two things: one - expand is better be places into .expand() method and another one, it's likely, you have incorrect expand and /Id part should not be there.

@github-actions
Copy link

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants