I'm having an issue with getting the Link to Document to update correctly when adding content via the API. The content item is getting moved to the correct folder OK, but the functioning URL is one from an intermediate state - possibly because we set the CreatedOn date.
I'm using AutoFolders v2.0.2, and Umbraco 4.0.4.2.
Our migration code fills in a handful of fields, including preserving the Date Created + Updated from the old system. We perform a publish + update cache, as was recommended in another tutorial. (See code below)
From here, all looks fine in the Umbraco content tree - The items have been successfully moved to the 'CreatedOn' date folder, and under Properties, the URL does reflect its place in the content tree.
However, the document can't be accessed via that URL - Only one indicating the date the migration took place.
E.g.:
The document should have a CreatedOn date of March 2010 (which we set), and it's currently June 2010. The URL is showing up (in the Umbraco UI, and with NiceUrl()) correctly as:
/Projects/2010/March/Your-content.aspx
But is still only accessible by
/Projects/2010/June/Your-content.aspx
So far the only way to fix this is 'Republish entire site' from the root node. Republishing from further down doesn't do the trick...
I have tried getting the import code to only save, not publish. This leaves it in the June directory, but a manual publish causes the same effect...
Import code:
(d is the Umbraco document, project is our source entity from another system)
// Maintain dates
if (project.DateCreated.HasValue)
d.CreateDateTime = project.DateCreated.Value;
if (project.DateUpdated.HasValue)
d.UpdateDate = project.DateUpdated.Value;
// Publish
d.Publish(User);
umbraco.library.UpdateDocumentCache(d.Id);
Link to Document & Data Migration
Hey there,
I'm having an issue with getting the Link to Document to update correctly when adding content via the API. The content item is getting moved to the correct folder OK, but the functioning URL is one from an intermediate state - possibly because we set the CreatedOn date.
I'm using AutoFolders v2.0.2, and Umbraco 4.0.4.2.
Our migration code fills in a handful of fields, including preserving the Date Created + Updated from the old system. We perform a publish + update cache, as was recommended in another tutorial. (See code below)
From here, all looks fine in the Umbraco content tree - The items have been successfully moved to the 'CreatedOn' date folder, and under Properties, the URL does reflect its place in the content tree.
However, the document can't be accessed via that URL - Only one indicating the date the migration took place.
E.g.:
The document should have a CreatedOn date of March 2010 (which we set), and it's currently June 2010. The URL is showing up (in the Umbraco UI, and with NiceUrl()) correctly as:
/Projects/2010/March/Your-content.aspx
But is still only accessible by
/Projects/2010/June/Your-content.aspx
So far the only way to fix this is 'Republish entire site' from the root node. Republishing from further down doesn't do the trick...
I have tried getting the import code to only save, not publish. This leaves it in the June directory, but a manual publish causes the same effect...
Import code:
Config:
Any & all help appreciated - thanks!
is working on a reply...