I'm adding some new content to an Umbraco 7.3 site through the Umbraco API and the content appears correctly in the back office and cmsContentXml cache table. The problem is that the new content doesn't appear on the site because it isn't in the umbraco.config file, if I republish the entire site the content then shows.
I don't want users to have to republish the site as the content is supposed to be imported automatically for them. I've been trying to regenerate the cache using the API but nothing causes the cache file to be updated.
I'm using:
contentService.RePublishAll();
contentService.RebuildXmlStructures(new int[] { UmbracoNodeUtils.PEOPLE_DOCUMENT_TYPE_ID, UmbracoNodeUtils.EXPERTISE_DOCUMENT_TYPE_ID });
I've also tried the following lines
umbraco.library.UpdateDocumentCache(createdNode.Id);
umbraco.library.RefreshContent();
but they throw an exception with the message
Value cannot be null.\r\nParameter name: refresher.
Does anybody have any idea how I can force the cache to update via the API or is there a better way of adding my content than SaveAndPublishWithStatus?