Vulnerability in EPiServer.Forms
I want to build a report that shows form submission data, but using the code below gives me nothing:
var formDataRepository = new FormDataRepository();
var formsInfo = _formRepository.Service.GetFormsInfo(null);
var membershipForm = formsInfo.Single(x => x.Name.Contains("<omitted>"));
var submittedData = formDataRepository.GetSubmissionData(new FormIdentity(membershipForm.FormGuid, string.Empty),
From what I've read, this may just returned data for just submitted forms or something. Or maybe I read that wrong. Either way, is there a way to achieve this?
I don't see any issue with your code. The question is where your form is created. If your form is created and stored under "For this page" local folder, you'll have challenge to get form's identity. The GetFormsInfo only find the form in the root folder under "EPiServer Form".
If you look into your database, FormData_xxxx (where xxx is your FormGuid), do you see any data that matches your query?
Also you might want to use the injected IFormDataRepository. In this case new FormDataRepository() is fine, but it is a bad pattern we'd want to avoid
I have tested in CMS 12, it works for forms stored under "Episerver Forms" folder (see attached)
GetFormsInfo will get all forms recursively, so it does not have to be under the Forms root. As I said, check the data you have in your database