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

can not get value of child items if using expand function #31

Closed
dalmatele opened this issue Aug 29, 2016 · 1 comment
Closed

can not get value of child items if using expand function #31

dalmatele opened this issue Aug 29, 2016 · 1 comment

Comments

@dalmatele
Copy link

I had this code:
$list->getItems()
->select("BuyerName,BuyerTitle,BuyerAddress,BuyerMobile,TrackingCodeTitle,"
. "BuyerPostalCode,Amount,ServiceCode/ServiceCode,Advisor/Title,CourseCode/Title")
->expand("ServiceCode,Advisor,CourseCode")
->filter($filter)
->top(1);
But, I can not get $item->Advisor[0]->Title.
As I saw in your code JsonPayloadSerializer.php:
in convertToClientObject function had this line code:
else {
$propertyObject = $targetObject->getProperty($key);
....
It's alway null, so you can get their value.
Can you fix that?

@vgrem
Copy link
Owner

vgrem commented Aug 31, 2016

Hi,
the issue with getting projected properties has been finally resolved.
Thank you for your investigation!

**Here is the example of getting user single field value

$items = $targetList->getItems(CamlQuery::createAllItemsQuery())
        ->select("AssignedTo/Title")
        ->expand("AssignedTo");
$context->load($items);
$context->executeQuery();

if($items->getCount() > 0){
        $item = $items->getItem(0);
        $assignedTo = $item->getProperty("AssignedTo");
        print $assignedTo->Title;
}

@vgrem vgrem closed this as completed Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants