3

How to get List item ID using Search API .

I am getting below properties along with that I need to get item id.

$keywordQuery.SelectProperties.Add("Created")
$keywordQuery.SelectProperties.Add("LastModifiedTime")
$keywordQuery.SelectProperties.Add("CreatedBy")
$keywordQuery.SelectProperties.Add("ModifiedBy")

I am retrieving all list items(list items and documents) created by a user in sites and its subsites. This is my query:

$queryText="createdby:xxxxxx"

How can i get listitem Id ?

3
  • you can try with adding $keywordQuery.SelectProperties.Add("ListItemID") and check Commented Jul 27, 2018 at 6:49
  • ListItemID property is also same for documents???
    – Swetha
    Commented Jul 27, 2018 at 7:05
  • yes, its the same Commented Jul 27, 2018 at 7:10

1 Answer 1

3

The list item's ID resides in a managed property named ListItemID.

So, you can add that in your selectproperties and it will give you the list item's ID.

Just add the below line in your code along with your current selectproperties :

$keywordQuery.SelectProperties.Add("ListItemID")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.