Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Suvery 2013 Submit response read programatically

$
0
0

Hi  I have a requirement to setup an approval for these survey, once approved, the survey item should be saved in a different document library as pdf file. Will you please provide your thoughts?

My plan is to build the survey out of the box, approval workflow out of the box, then use the event handler to read the item programmatically and then save as pdf in a document library.

I have an issue reading Submitted survey items programmatically. It doesn't return anything. Will you please advise?

public override void ItemAdded(SPItemEventProperties properties)
        {
            base.ItemAdded(properties);

            if (properties.List.Title == "Feedback")
            {
                Thread.Sleep(5000);
                SPListItem surveyItem = properties.ListItem;
                using (SPSite trSite = new SPSite(properties.WebUrl))
                {
                    using (SPWeb oWeb = trSite.OpenWeb(properties.RelativeWebUrl))
                    {
                        SPSecurity.RunWithElevatedPrivileges(delegate ()
                        {

                                foreach (SPField field in surveyItem.Fields)
                                {
                                    if (field.TypeAsString != "PageSeparator")
                                    {
                                        string response = field.Title.ToString();
                                    }
                                }
                          });
                    }
                }

            }

This doesn't fire. I am fine if I can read and export item as pdf file using console application. Will you please help.

Shri


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>