Vulnerability in EPiServer.Forms
I have a custom scheduled job that creates and updates pages from a third-party API.
The initial create and subsequent updates from the external API work fine. I can push data, but can't seem to pull data for comparison purposes. Here are the basics in my job:
var svc = ServiceLocator.Current;var repo = svc.GetInstance<IContentRepository>();var contentType = svc.GetInstance<IContentTypeRepository>().Load<MyPage>(); var contentList = svc.GetInstance<ContentStore>().ListContentOfContentType(contentType, false).ToList();var myPageLink = contentList?.FirstOrDefault(x => x.Name == myData.Name);var page = repo.Get<MyPage>(myPageLink.ContentLink);var clonePage = page.CreateWritableClone() as MyPage;clonePage.Prop1 = myData.Prop1;if (clonePage.Prop2 == null) clonePage.Prop2 = myData.Prop2;...repo.Save(clonePage , SaveAction.Publish, AccessLevel.NoAccess);
When I debug and inspect both the page and the clonePage objects, none of the property values are there. I would imagine an item that is read or cloned would contain it's values.
Help! What am I missing here?
Hi, does 'myPageLink' have a work ID? If so, you will load a specific version of that content, and this version might lack the data you're expecting. If you want to load the latest version of the content, then you can use repo.Get<MyPage>(myPageLink.ContentLink.ToRefereenceWithoutVersion()).