I am attempting to write a scheduled job that imports our existing categories into the CMS using the content model. The problem that I am seeing is that I have a catalog, but I cannot insert my newly created categories directly to the catalog. Instead I have to manually create a dummy category with a code, then insert my new categories, via the code, into the system where the parent Link is a reference to the manually created dummy category. Is there a way to insert directly to the catalog since I don't want the extra layer in the catalog tree.
Of course, you just have to get the ContentReference of your Catalog instead, and use that as parentLink. As you've noticed the catalog has no Code that you can pass to the ReferenceConverter (which I assume you're using) to get the ContentReference. Instead, you need to get the numeric ID of the catalog and use another method overload on ReferenceConverter to pass it the catalog id, the CatalogContentType.Catalog enum and workId 0. Another way to find the catalog is to call IContentRepository.GetChildren with the RootLink field of the ReferenceConverter. This will give you the list of your existing catalogs (which are always children of the root), and you can find the appropriate catalog e.g. by its name.
Terrific, thank you Magnus.