Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Newsletter subscriber data export (with custom new fields) View modes: 
User avatar
Member
Member
ryan.andrianto-worldvision.com - 8/3/2009 7:38:56 PM
   
Newsletter subscriber data export (with custom new fields)
Hi all,

I've modified my newsletter subscriber data to receive an extra field (state).
All savings, update process to that new 'state' field is done and working ok.

But when i tried to export the subscribers through the export function (cmsdesk > tools > newsletter > export subscribers) I still don;t have the new 'state' field as part of the data.

I've already added the new field to the system tables > newsletter.subscribers and also update the query for export accordingly with the new field name.

Any suggestion on how to make this working? is this actually a cms limitation? or if there's any work around I'd love to know then.

Thanks

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 8/4/2009 5:43:34 AM
   
RE:Newsletter subscriber data export (with custom new fields)
Hi,

If you would like to involve your custom data to subscribers you would need to re-write the code in:

<web site folder>\CMSModules\Newsletters\Tools\ImportExportSubscribers\Subscriber_Export.aspx.cs

Please find the line about 90:
subscribers = SubscriberProvider.ExportSubscribersFromSite(newsletterIds, CMSContext.CurrentSite.SiteID, true);
you may add your own function here.

You can access the table: Newsletter_Subscriber and select all data you need. The output of this function should be a string which contains rows for particular subscribers in format:
attribute1;attribute2;attribute3;attribute4\n

Best regards,
Helena Grulichova

User avatar
Member
Member
ryan.andrianto-worldvision.com - 8/4/2009 5:36:42 PM
   
RE:Newsletter subscriber data export (with custom new fields)
Thanks,

I believe that it'll be a slight modification to the base function needed. But i couldn't seem to see the actual code for that function is there anywhere i could retreive it? It'll be much quicker if I just modified the code rather than write a complete new one.

subscribers = SubscriberProvider.ExportSubscribersFromSite(newsletterIds, CMSContext.CurrentSite.SiteID, true);

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 8/8/2009 3:11:54 AM
   
RE:Newsletter subscriber data export (with custom new fields)
Hello,

The SubscriberProvider.ExportSubscribersFromSite method is defined in CMS.Newsletter.dll library and unfortunately you don't have access code of this library unless you have license with source code. But basically you can use ExecuteQuery method with "newsletter.subscriber.SelectForSubExport" or "newsletter.subscriber.SelectAllForSubExport" query to get DataSet with all fields of subscribers.

Best Regards,

Martin Dobsicek