2

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 ?

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

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, privacy policy and cookie policy

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