Developer forum

Forum » Development » How to get Item field "Do not include in search" using the API?

How to get Item field "Do not include in search" using the API?

Pedro Meias
Pedro Meias
Reply

Hello,

Is there a way we can get the value in item field property Do not include in search using the API?

We are using an item published and would like to exclude from the search all fields that have this property set to true.

 

Thank you.


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Pedro

The information is available on the ItemField object: https://doc.dynamicweb.com/apix/api/Dynamicweb.Content.Items.Metadata.ItemField.html#Dynamicweb_Content_Items_Metadata_ItemField_ExcludeFromSearch

You can do something like this:

var meta = ItemManager.Metadata.GetItemType("ItemTypeSystemName");
var fields = meta.GetAllFields();
foreach (ItemField field in fields)
    var excludeFromSearch = field.ExcludeFromSearch;
}
Votes for this answer: 1
 
Pedro Meias
Pedro Meias
Reply

Hi Nicolai,

That does it! Thank you so much for your help.

 

You must be logged in to post in the forum