Try Now
More in this section

Forums / Developing with Sitefinity / How to get forms setting by sitefinikty api

How to get forms setting by sitefinikty api

2 posts, 0 answered
  1. Ajai
    Ajai avatar
    15 posts
    02 Mar 2015
    15 Sep 2015
    Link to this post

    Hi All,

    I am using sitefinity 8.1.I have created a contact us from in sitefinity forms section.I am adding responses to the forms by using api.So i would like to send a notification email to the mail addresses that configured under the setting section of the form.How can i get that details (response settings) by sitefinity api?



  2. Angel Moret
    Angel Moret avatar
    29 posts
    25 Oct 2016
    02 Oct 2015
    Link to this post
    Hello Ajai,

    The following code sample returns the list of emails that are entered through the backend setting:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Telerik.Sitefinity.Modules.Forms;
    using Telerik.Sitefinity.Services;
    using Telerik.Sitefinity.Services.Notifications;
    namespace SitefinityWebApp
        public partial class GetFormSubscribersMailsForm : System.Web.UI.Page
            protected void Page_Load(object sender, EventArgs e)
        var emails = this.GetFormSubscribersMails("MyForm");
            public List<string> GetFormSubscribersMails(string formTitle)
        var formsManager = FormsManager.GetManager();
        var form = formsManager.GetForms().Where(f=> f.Title == formTitle).FirstOrDefault();
        var notificationService = SystemManager.GetNotificationService();
        var serviceContext = new ServiceContext("ThisApplicationKey", FormsModule.ModuleName);
        var subscribedEmails = notificationService.GetSubscribers(serviceContext, form.SubscriptionListId, null)
        .Where(s => s.Email == s.ResolveKey)
        .Select(s => s.Email)
        return subscribedEmails;

    I would like to note that this will return only the emails entered in the settings tab in the backend. If you have subscribed  to the form via its Actions menu, this email will not be retrieved.

    I hope this helps.

    Angel Moret
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered