Hi! We don't get the FetchData functionality to work in 7.19.2, Any idea? It did work in CMS6r2
var mirrored = ContentFactory.CreateContent(type);
(mirrored as NewsItem).LinkType = PageShortcutType.FetchData;
(mirrored as NewsItem).Property["PageShortcutLink"].Value = original.ContentLink;
In the UI it stands that it "Shortcut type" is set to "Fetch content from page in EPiServer CMS" but no content shows. FetchData from the UI is working fine.
The below works fine for me:
var pageRepositor = ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();
var page = pageRepositor.Get<StandardPage>(new ContentReference(255));
var pageClone = page.CreateWritableClone();
var pageOri = pageRepositor.Get<StandardPage>(new ContentReference(16));
pageClone.LinkType = PageShortcutType.FetchData;
pageClone.Property["PageShortcutLink"].Value = pageOri.ContentLink;
The difference from ours to your code is that we are in LoadContent in a ContentProvider so we do not save to the database and therefor don't need any CreateWritableClone. It doesn't work and doesn't make any since.
Any other idea? Are we suppose to implement the FetchData ourselfs on the template (webforms)?
We are using a lot of <EPiServer:Property PropertyName="Phone" ID="propPhone" runat="server" /> and it should be automatic....
I didnt' know that you are using ContentProvider. Can you try calling MakeReadOnly method on the content to see if it works? Something like: mirrored.MakeReadOnly()