Try our conversational search powered by Generative AI!

FetchData not working


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.

Mar 12, 2015 12:10


Mar 16, 2015 7:50

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;
            pageRepositor.Save(pageClone, DataAccess.SaveAction.Publish);
Mar 16, 2015 9:46

Hey Le,

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....

Edited, Mar 16, 2015 10:45

I didnt' know that you are using ContentProvider. Can you try calling MakeReadOnly method on the content to see if it works?
Something like:

Mar 23, 2015 14:12


Mar 23, 2015 14:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.