Hope someone has a good solution for this problem as it is driving me crazy... :-)
I've created a synchronizer mechanism in my umbraco-solution which is responsible for adding documents to Umbraco from an external source.
I've created the synchronizer file as CampaignSynchronizer.aspx in the root of my website (and obviously told Umbraco to not treat this as Umbraco content when it is requested!).
This aspx file is called with an Id for the external information and will lookup this info itself and then adding the content to Umbraco.
All is fine - new documents are added to Umbraco when the synchronizer runs but when I try to view the ´content I get a completely white page!
I do this in my synchonizer:
d.SaveAndPublish();
umbraco.
library.UpdateDocumentCache(d.Id);
umbracoUtilities.Search.
Indexer.AddPageToIndex(d.Id);
(where d is a Document type)
As I stated everything look fine in Umbraco - the document is there - has the icon of published but when I try to view the page - totally white page is shown...
I found out that a workaround is to hit the "Save and publish" button in Umbraco - then the page views fine....?
My concern is that maybe Umbraco doesn't see this content as published. In the page view we use "nodes" of this documenttype when showing it.
Below you find an example to create a document and publish it. In your CampaignSynchronizer.aspx page you need to add references to the dll's umbraco,cms,businesslogic and Interfaces.
What's important when you publish is that you first call the publish method on your document and then call the umbraco.library.UpdateDocumentCache method.
Document doc = newDocument();
doc.ContentType =
DocumentType.GetByAlias("the alias of your doctype");
After looking into the code I discovered a bug... (not in Umbraco but my own code...) :-)
I had to versions of the hitting the create document (one with a new document and one to update existing) and when entering the create I forgot to publish the document...!
Sometimes you just need to look at the little things... :-)
Create document through api - publish problem
Hi all
Hope someone has a good solution for this problem as it is driving me crazy... :-)
I've created a synchronizer mechanism in my umbraco-solution which is responsible for adding documents to Umbraco from an external source.
I've created the synchronizer file as CampaignSynchronizer.aspx in the root of my website (and obviously told Umbraco to not treat this as Umbraco content when it is requested!).
This aspx file is called with an Id for the external information and will lookup this info itself and then adding the content to Umbraco.
All is fine - new documents are added to Umbraco when the synchronizer runs but when I try to view the ´content I get a completely white page!
I do this in my synchonizer:
d.SaveAndPublish();
umbraco.
library.UpdateDocumentCache(d.Id);
umbracoUtilities.Search.
Indexer.AddPageToIndex(d.Id);
(where d is a Document type)
As I stated everything look fine in Umbraco - the document is there - has the icon of published but when I try to view the page - totally white page is shown...
I found out that a workaround is to hit the "Save and publish" button in Umbraco - then the page views fine....?
My concern is that maybe Umbraco doesn't see this content as published. In the page view we use "nodes" of this documenttype when showing it.
Any help will be greatly appreciated...
Kind regards, Thomas
Hi Thomas,
Below you find an example to create a document and publish it. In your CampaignSynchronizer.aspx page you need to add references to the dll's umbraco,cms,businesslogic and Interfaces.
What's important when you publish is that you first call the publish method on your document and then call the umbraco.library.UpdateDocumentCache method.
Hope it helps you,
Richard
Hi
After looking into the code I discovered a bug... (not in Umbraco but my own code...) :-)
I had to versions of the hitting the create document (one with a new document and one to update existing) and when entering the create I forgot to publish the document...!
Sometimes you just need to look at the little things... :-)
This post is no more...
Kind regards
Thomas
is working on a reply...