Change LinkType and PageShortcutLink programmatically

Vote:
 
Trying to change multiple pages to fetch data from a specified page by setting LinkType and PageShortcutLink but it throws an exception. How am I supposed to do it?

 

PageData page = DataFactory.Instance.GetPage(new PageReference(pageId));

page = page.CreateWritableClone();

page.LinkType = PageShortcutType.FetchData;
page.Property["PageShortcutLink"].Value = new PageReference(fetchId);

DataFactory.Instance.Save(page, EPiServer.DataAccess.SaveAction.Publish);
Throws: The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_tblWorkPage_tblPage1". The conflict occurred in database "EPiServerTest", table "dbo.tblPage", column 'pkID'. 

 

#27047
Jan 15, 2009 11:40
Vote:
 
Worked when i came back from lunch, strange...
#27065
Jan 15, 2009 13:58