I’ve inherited an older Umbraco Pro install (4.11) with an
unknown version of Contour installed (doesn’t show as an installed package, but
it is installed and working). I think the Contour is 1.x (yes, I'd love to upggrade to newest releases, but... time & money)
Originally, we had a form (Name, email) for visitors to use
to subscribe to a desired page, to be notified of changes. Data gathered was stored in SQL server. My predecessor wrote
a usercontrol (available as a tab in the members section) that lets the CIO
select a page (group) and define an email to send to all members(subscribers)
of that page (group).
At some later point, my predecessor set up a Contour form
for this use, with the results stored as Contour entries.
Unfortunately, no one noticed that the usercontrol was still
processing old data stored SQL server, and not the new
subscriptions stored as Contour entries.
Here is the original (current) code:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web.Security;
using umbraco;
using umbraco.presentation.nodeFactory;
using Umbraco.Forms.Core;
using Umbraco.Forms.Data.Storage;
namespace MemberManagement
{
public partial class MemberManagement : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (emailGroupChoices.Items.Count == 0)
{
string[] membershipGroups = Roles.GetAllRoles();
foreach (string group in membershipGroups)
{
emailGroupChoices.Items.Add(group);
GetSubscribersChoices.Items.Add(group);
}
}
}
protected void Send_Email(object sender, EventArgs e)
{
string emailSubject = MessageSubject.Value;
string emailText = MessageText.Value;
string[] theUsers = Roles.GetUsersInRole(emailGroupChoices.Text);
foreach (string user in theUsers)
{
MembershipUser theUser = Membership.GetUser(user);
library.SendMail(UmbracoSettings.NotificationEmailSender, theUser.Email, emailSubject, emailText, false);
}
emailResults.InnerHtml = "<p>The email was successfully sent to " + theUsers.Count().ToString() + " recipients</p>";
}
}
}
There are other utilities in this usercontrol as well, such as Migrate_Subscribers(from group to group), Delete_Subscriber, and Get_Members_By_Group.
I'd like to re-write these function to use the Contour entries we're actually storing subscriptions in... but am having a very difficult time of it. I do not want to use XSLT, and would rather not start over with a Razor setup.... documentation for webforms_usercontrols + Contour seem to be scarce.
Could one of you fine souls point me in a good direction for this, please?
Thanks for taking the time to reply. I know I described my problem poorly, let me step back to a higher perspective and try again.
I have a Contour form that allows visitors to subscribe to a specific webpage. The form asks for their name and email address. The results are stored in Contour entries, including the user's name, email, pageId m IP address, etc.
In the backoffice, in the Members section, I want a usercontrol (tab) with some tools on it for our CIO to use, including a form she will use to enter a subject, a message body, and a drop-down which she will use to select a page (group) which has been updated. She types in the subject and body, clicks Send.. and the tool needs to get all the email addresses of users who have subscribed to that particular page, and send the message (email) to them.
Now, we do have the usercontrol, but it is not querying Contour for the emails.. it's querying Umbraco.Membership (which we apparently used to be using). This usercontrol is an ASP.NET usercontrol, and while I have read the Contour docs you linked, they seem to be focused on XSLT and Razor views, with little I can use to query Contour otherwise (like an ASP.NET usercontrol). This may be complicated by the liklihood that my Contour version is as old as my Umbraco install (4.11). I do understand that Razor is recommended, and would willingly go that direction, but this work is unfunded - the boss wants it done, but there is no budget for modifying the Umbraco install (hence the old version).
TL;DR: How do I enumerate Contour entries containing names and email addresses then use them to trigger a mass-email to our subscribers while using an ASP.NET usercontrol?
(I'm also attempting to update Umbraco/Contour to current versions ona test server in my copious free time... this isnt going well either)
Thank you for whatever help you can provide. Maybe I wont be such a noob after the class in Vegas.
Requesting help with emailing
Greetings,
I’ve inherited an older Umbraco Pro install (4.11) with an unknown version of Contour installed (doesn’t show as an installed package, but it is installed and working). I think the Contour is 1.x (yes, I'd love to upggrade to newest releases, but... time & money)
Originally, we had a form (Name, email) for visitors to use to subscribe to a desired page, to be notified of changes. Data gathered was stored in SQL server. My predecessor wrote a usercontrol (available as a tab in the members section) that lets the CIO select a page (group) and define an email to send to all members(subscribers) of that page (group).
At some later point, my predecessor set up a Contour form for this use, with the results stored as Contour entries.
Unfortunately, no one noticed that the usercontrol was still processing old data stored SQL server, and not the new subscriptions stored as Contour entries.
Here is the original (current) code:
Comment author was deleted
Not sure I understand what you are trying to do
Check http://our.umbraco.org/projects/umbraco-pro/contour/documentation for the latest docs :)
Maybe the code first approach could be a good help for you
Details here http://umbraco.com/follow-us/blog-archive/2012/11/6/contour-30-features-code-first.aspx
Hi Tim,
Thanks for taking the time to reply. I know I described my problem poorly, let me step back to a higher perspective and try again.
I have a Contour form that allows visitors to subscribe to a specific webpage. The form asks for their name and email address. The results are stored in Contour entries, including the user's name, email, pageId m IP address, etc.
In the backoffice, in the Members section, I want a usercontrol (tab) with some tools on it for our CIO to use, including a form she will use to enter a subject, a message body, and a drop-down which she will use to select a page (group) which has been updated. She types in the subject and body, clicks Send.. and the tool needs to get all the email addresses of users who have subscribed to that particular page, and send the message (email) to them.
Now, we do have the usercontrol, but it is not querying Contour for the emails.. it's querying Umbraco.Membership (which we apparently used to be using). This usercontrol is an ASP.NET usercontrol, and while I have read the Contour docs you linked, they seem to be focused on XSLT and Razor views, with little I can use to query Contour otherwise (like an ASP.NET usercontrol). This may be complicated by the liklihood that my Contour version is as old as my Umbraco install (4.11). I do understand that Razor is recommended, and would willingly go that direction, but this work is unfunded - the boss wants it done, but there is no budget for modifying the Umbraco install (hence the old version).
TL;DR: How do I enumerate Contour entries containing names and email addresses then use them to trigger a mass-email to our subscribers while using an ASP.NET usercontrol?
(I'm also attempting to update Umbraco/Contour to current versions ona test server in my copious free time... this isnt going well either)
Thank you for whatever help you can provide. Maybe I wont be such a noob after the class in Vegas.
Gerry
is working on a reply...