2012-01-01 52 views

回答

0

我相信这样的事情应该工作:

int shortcutId = ...; 

newPage.LinkType = PageShortcutType.Shortcut; 
newPage.Property["PageShortcutLink"].Value = new PageReference(shortcutId); 
+0

不知道为什么我没有尝试这个,但我确实做到了这个把戏:) grazie mille – Kulvis 2012-01-01 19:55:04

+0

您应该考虑使用MetaDataProperties类的常量,而不是为此输入完整的字符串名称。 – 2015-10-22 10:31:47

0

你必须调用CreateWritableClone方法,因为财产PageShortcutLink是只读的

这里我的代码:

PageReference prtest = new PageReference(21602); 
PageReference prlinked = new PageReference(21603); 
PageData pdtest = DataFactory.Instance.GetPage(prtest); 
PageData pdClone = pdtest.CreateWritableClone(); 
pdClone.LinkType = PageShortcutType.Shortcut; 
pdClone.Property["PageShortcutLink"].Value = prlinked; 
DataFactory.Instance.Save(pdClone, SaveAction.Publish);