What's the argument name to be passed in for hiding a News Item from the navigation menu when using api.content.create?

Currently, I have a script that is used to import data into Plone, however, each News Item is added to navigation bar. I want to avoid this. At first, I tried exclude_from_nav=True and excludeFromNav=True, but it's not working.

My import code looks like this:

def create_news_item(level, id, base_path, path_, name, data):
    otherdata = {
        "atrefs":data.get("_atrefs", {}),
    if "image" in data:
        otherdata["image"] = data["image"]
        otherdata["imageCaption"] = data["imageCaption"]
    _path = "/".join(base_path.split('/')[:-1])
    if level > 1:
        container = api.content.get(path=_path)
        container = api.portal.get()
    if container and id not in container:
        obj = newsitem = api.content.create(
            type='News Item',
        setuid(obj, data['_uid'])
        if '_datafield_image' in data:
            image_data = data['_datafield_image']
            newsitem.image = prep_image(
        print "content already present for {}".format(base_path)
    print "type is :{}, path is:{},{}".format(data['_type'],
                         data['_path'], level + 2)

Any ideas?

Tried to reindex the created object?
Check the portal_catalog -> Contents and inspect the indexed values for your content object.

Otherwise try



Thanks. obj object doesn't have the method setExcludeFormNav, however, the reindexObject method did the trick.

I assume you're using a Dexterity-based content type and that's why you don't have the setExcludeFromNav method available.

reindexObject updates the catalog so your change is reflected there; most of Plone UI stuff uses the catalog to retrieve information about content items instead of accessing them directly, because is faster and uses less memory.