Hi,
Im trying to add additional aliases like you can do in the CMSDESK but with the API and I have no luck.
I'm trying this but it doesn't update the document.
DocumentAliasInfo dai = new DocumentAliasInfo(); dai.AliasURLPath = aditionalAlias; dai.AliasCulture = "en-us"; dai.AliasSiteID = CMS.SiteProvider.SiteInfoProvider.CurrentSiteID; dai.AliasNodeID = node.NodeID;
node.Aliases.Add(dai);
This is bases on https://devnet.kentico.com/forums/f48/fp5/t20637/how-to-add-additional-document-aliases-using-th
But dont work either.
If somebody can get me documentation for this I would appreciete.
Kind regards
It looks like you haven't saved your DocumentAliasInfo object. I think you have to save it right before you call
I might be wrong as I'm now sure how it works in Kentico 7
There is a documentation how to use API for this purpose Creating a page alias. Just read it. And I think it's the same for Kentico 7. You need to save DocumentAliasInfo without adding it to TreeNode item, because DocumentAliasInfo item already has AliasNodeID property which is a link to your node.
It worked using dai.Insert(); after building the object.
Regards
Please, sign in to be able to submit a new answer.