Sitecore MailingList Module

I recently had the opportunity to work with the Sitecore 5.3 MailingList Module and since it was my first time, I had to hunt around the API to figure out how to have a site visitor subscribe and unsubscribe from a MailingList. The only thing I could find was this post by Alex Shyba from back in 2005 when I guess it was actually called the Newsletter module.

This post is actually self serving, in that I will never have to hunt for it again. First, you of course have to install the MailingList Module and then Add a Reference to the Sitecore.MailingList.dll in the bin folder. Then add:

using Sitecore.Modules.MailingList.Core;

It needs some parameter validation before being 100%, but here goes:

private void SaveSubscriber(string firstName, string lastName, string email, string gender, string age)
{
    MailingList list = new MailingList();
    string listID = Sitecore.Context.Database.Items.GetItem("/sitecore/content/modules/mailing list/mailing lists/Newsletter").ID.ToString();
    string name = firstName + " " + lastName;
    string company = "";
    string country = Sitecore.Context.Language.ToString();
    list.PutSubscriber(name, email, company, country);
    // listID parameter says it’s listID’s although it’s not a string array, beats me
    list.Subscribe(name, email, listID);
    // you can send any parameters here that you want
    list.PutSubscriberField(email, "Gender", gender);
    list.PutSubscriberField(email, "Age", age);
}

private void RemoveSubscriber(string email)
{
    MailingList list = new MailingList();
    string listID = Sitecore.Context.Database.Items.GetItem("/sitecore/content/modules/mailing list/mailing lists/Newsletter").ID.ToString();
    // Second parameter expects string array of Newsletter Sitecode Id’s to subscribe to.
    list.Unsubscribe(email, listID.Split(‘,’));
}

Let me know if you find it useful or know of something I was overlooking. Most of this was taking from Alex’s post and just updated to Sitecore CMS version 5.3.

Technorati Tags: ,,,

Quick Catch Up – New Gig, New Focus, MVP Summit, TechEd 2008!

Okay. Here’s a few long overdue house cleaning items:

1. VSLive! Austin – Nov 14, 2007 – my presentation on the .NET 3.0 LIVE! Track went very well – Putting it all together with .NET 3.0: Presentation, Services and Workflows. I finally got to see some of the heavy hitter presenters – Billy Hollis, Ken Getz, Mark Michaelis, Richard Hale Shaw, PDSA, Inc and Michael Stiefel.

2. New Employer – Back in March, I switched employers! I am now a Technical Specialist for The Revere Group, an NTT Data Company. Where I have been focusing primarily on public facing web sites utilizing the .NET Enterprise Content Management System – Sitecore CMS. The last project with my previous employer was deployed the week before I left, utilizing MOSS 2007 for the public facing web site, for the National Professional Paintball League. I definitely feel invested in all the projects that I worked on and hope them, the company and my past co-workers continued success.

3. MVP Summit 2008 – An opportunity that could not be passed up. Seeing the keynotes by Ray Ozzie and Steve Ballmer, plus all the break-out sessions with the product teams, etc, it was definitely priceless. I even tacked on an extra day for the World Wide User Group Management Summit, just wish I could’ve made the ALT.NET conference that was going on that weekend as well. One thing that amazes me is how many people have said they want to be an MVP. How do you become one, etc. Even after giving them some brief advise with some of the simplest things to do, nothing – just lip service.  The MVP Summit itself is worth it. Get involved in your communities.

4. Tulsa’s first annual School of Dev! – After having our first successful TulsaCodeCamp on March 10, 2007, I decided to come up with something new and exciting. Who knows maybe someone will start repeating it, like what’s happened with the TechFest events. <hint.. hint> I can provide hosting for anyone who wants to, since I built the SchoolofDev.com site with that in mind from the beginning using WSS (Windows SharePoint Services – will skin it later). If you missed it, take a look at the Agenda, Speakers and over $130,000+ worth of prizes that were given away. Thanks to all our Sponsors. Every attendee could even get Continuing Education credit from Tulsa Community College!

5. Microsoft TechEd – I have had the honor of having my session selected for the Developers Office track – How to Use Microsoft Office SharePoint Server 2007 as an Application Development Architecture: Not your typical Microsoft Office SharePoint Server (MOSS) development and deployment. Having worked on small projects all the way to large public facing social networking sites, you too can learn how MOSS is much more than just an Intranet-in-the-box solution. It can be utilized as the application development architecture of the future. It offers tremendous time savings for development and deployment. Learn the best practices for setting up your server architecture for redundancy and high performance. Learn the pain points to watch out for as well as all the short cuts to make your next Web application ready for prime time.

Microsoft Learning to launch groups for Microsoft Certified Professionals on LinkedIn!

For those that have questioned the value of LinkedIn, it is about to receive a big boost – Microsoft Learning just announced they are going to be launching groups for Microsoft Certified Professionals (MCP, MCSE, etc). This is great news.

It is also just alittle confusing, considering that Microsoft made a huge investment in Facebook a few months ago. Why would they pick LinkedIn first? Facebook does already have a few Microsoft groups, like one for Microsoft MVP's, Silverlight Fans, Sharepoint Fans, etc, but for the most part they were created by the community. They should do the same with MCP's as well. The main difference with these groups is that only those that have achieved the respective certifications will be allowed to join the groups.

Either way, kudos for taking advantage of these tools to keep people connected and sharing!

http://blogs.msdn.com/trika/archive/2008/02/13/certified-on-linkedin.aspx

WARNING: Boycott WHOIS via Network Solutions

I have been in the habit for quite some time of still using the whois search by going to netsol.com (Network Solutions). For those that haven’t read the Left Behind book series, there is a very similar and ironic twist to the "netsol" concept and it stuck with me.

Anyway, I just learned the hard way today, that Network Solutions is now registering domains that have been searched for via their whois tool.

I was doing some preliminary research on the replacement for this year’s TulsaCodeCamp event, since I wanted to come up with something new, unique and maybe repeatable (hint). After seeing the available domain names and weighing the options, I went to register the domain I had picked using my usual registrar GoDaddy only to be informed it was no longer available.

I went back to "netsol" and this time when I searched it said "available here". Looking at their whois record and out of curiosity the whois record via GoDaddy, both said it was registered just today 1/29/08 by Network Solutions and even says "Available there".

Where is INTERNIC? This situation is only getting worse by the minute. Not only are there the lowest of the low, slimiest of the slime, cyber squatters who predatorily jump on a domain and put up nothing but a stupid search script. There’s the registrars that charge exorbitant late fees (like 12x annual fees) to renew at about 15 days late, then when you don’t bow to their demands, hold on to the domain for several years hosting nothing but the same stupid search scripts.

This is the one time I welcome some form of oversight, whether it be INTERNIC, the US Government, United Nations, somebody please end this. It is so very bad for the public, customers and the general internet populace.

DotNetNuke Twitter XSL Transformation

I have become a big fan of Twitter. It helps bridge the gap between blog posts and IM. It's also a great way to keep people informed quickly and easily.

Of course, the very first thing I wanted to do was display the tweets on the various DotNetNuke sites I own and operate.

The XSLT transform that comes with DotNetNuke was pretty ugly when displaying the Twitter RSS feed, so I hacked up some modifications using Visual Studio 2008. It provides a great IDE to debug XSLTs. The only spot of this XSLT that will need tweaking for you is the TimeZone Offset (tzOffset) variable. I wanted it to display my tweets time based on my time zone CST.

Feel free to modify this to your hearts content. Let me know if you come up with any cool changes! Have fun! (You can also download it via: http://www.davidlwalker.com/Portals/1/twitter.xsl)

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform>
  <xsl:output method="html" indent="yes"/>
  <xsl:template match="rss/channel">
    <xsl:for-each select="item[position() &lt; 11]">
      <div class="twitterEntry">
        <p>
          <a href="{link}">
            <xsl:call-template name="getDate">
              <xsl:with-param name="dateTime" select="pubDate" />
              <xsl:with-param name="tzOffset" select="-6" />
            </xsl:call-template>
          </a>
          –   <xsl:value-of select="substring-after(title,': ')" />
        </p>
      </div>
    </xsl:for-each>
  </xsl:template>

  <xsl:template name="getDate">
    <xsl:param name="dateTime" />
    <xsl:param name="tzOffset" />
    <xsl:value-of select="substring($dateTime,9,4)" />
    <xsl:value-of select="substring($dateTime,6,2)" />
    <xsl:text>,</xsl:text>
    <xsl:value-of select="substring($dateTime,12,6)" />
    <xsl:variable name="orighour">
      <xsl:choose>
        <xsl:when test="(number(substring($dateTime,18,2))+number($tzOffset)) &lt; 0">
          <xsl:value-of select="(12+(number(substring($dateTime,18,2))+number($tzOffset)))+12" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="number(substring($dateTime,18,2))+number($tzOffset)" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="hour">
      <xsl:choose>
        <xsl:when test="$orighour &gt; 12">
          <xsl:value-of select="number($orighour)-12" />
        </xsl:when>
        <xsl:when test="$orighour = 0">
          <xsl:value-of select="'12'" />
        </xsl:when>
        <xsl:when test="$orighour = 12">
          <xsl:value-of select="'12'" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="number($orighour)-12" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="ampm" >
      <xsl:choose>
        <xsl:when test="$orighour &gt; 11">
          <xsl:value-of select="' PM'" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="' AM'" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:value-of select="$hour" />
    <xsl:value-of select="substring($dateTime,20,3)" />
    <xsl:value-of select="$ampm" />
  </xsl:template>

</xsl:stylesheet>

Technorati Tags: ,,,,

TechFest domination continues! DallasTechFest is finally coming – May 3rd 2008!

Our Microsoft Developer Evangelist, Chris Koenig, just announced it on his blogDallasTechFest will be May 3rd 2008.

Yet another city is destined for the inevitable world domination of TechFest.

All signs point to some big numbers in 2008. Since all the events have been very successful so far (TulsaTechFest, VancouverTechFest, HoustonTechFest, IndyTechFest and AlbertaTechFest), it would seem logical they will repeat next year as well. Thereby, doubling the number of TechFest events. I am proud to say TulsaTechFest is a trend setter.

I think we should all let John Kellar (Founder and Chairman of Nashville's devLink and before that Co-Founder of Little Rock's TechExpo) that the answer to his twitter "should there be a devLink 2008" is a resounding yes and no. NashvilleTechFest has a nice ring to it, eh?

TechFest: achieving world domination! HoustonTechFest was a blast!

This post really should have came before my TulsaTechFest.com post chronologically, but I already had that one prepared, so I picked the lowest hanging fruit first.

I had the opportunity to speak at the first annual HoustonTechFest.com on August 25th, 2007. It was a very awesome event. Michael Steinberg and the team from the HoustonDNUG did a terrific job. I got to talk to Ben Scheirman, who I got to meet recently at the OKCodeCamp where we were both presenting again as well, fellow Commodore-64 starter Scott Bateman. It’s always great to see Microsoft supporting these community driven events with the likes of Chris Koenig, Zain Naboulsi, Phil Wheat and of course Brad Abrams speaking.

It was very inspiring to see that the concept I began with TulsaTechFest in 2006 has started to spread into the larger cities. VancouverTechFest was the first thanks to Rob Chartier and Richard Campbell. They even started up a manifesto for it. Which we tried to follow, but we very successfully found that only having content on weekends doesn’t appear to be as successful as the weekdays (see previous post) and below numbers.

My Windows Communication Foundation Presentation:

The thing that I find most astonishing is that even after a whole year of it’s release, the .NET 3.0 Framework is still unheard of by many attendees to these types of events. Therefore, even though as a presenter I feel like Microsoft Windows Communication Foundation (WCF) is old news, since I have been studying and presenting on it for a year and half while it was still in Beta. I will just continue to bring the personal in-depth experience on the production usage of WCF in a high volume environments as well as consistently looking for the best way to present on the technology in easy to understand terms. With nothing more than the end goal of getting developers to start studying, learning and at least experimenting/playing with this and the rest of the .NET 3.0 Framework. Do I even have to say that these things have not changed much in the newly released Microsoft Visual Studio 2008 – .NET 3.5 Framework? The tools only continue to improve thanks to the Microsoft Patterns & Practices Team and the WCF Service Software Factory project, which Nov 9th released version 3.0 – Modeling Edition! Definitely download this and the 2.0 version and start seeing what interconnected application development can do for your enterprise solutions.

With good reason, I had to delay this post. I just happened to come across Bill Steele’s post regarding IndyTechFest.com! It is amazing to see an idea start to benefit all these other communities! It’s a good thing I started it with pure intentions – the contribution to the community, if I had been seeking ulterior motives I would have done things a lot differently.

Here’s the events in a chronological order for everyone:

  1. October 14, 2006 – TulsaTechFest 2006 – 20 tracks, 119 sessions, 60+ speakers, 650+ registered, 360+ attendees
  2. November 14, 2006 – Santa Fe TechFest – details unknown, info from J. Michael Palermo Blog
  3. November 15, 2006 – Phoenix TechFest – details unknown, info from J. Michael Palermo Blog
  4. February 24, 2007 – VancouverTechFest – 4 tracks, 28 sessions, 25 speakers, 575 registered, ??? attendees
  5. August 25, 2007 – HoustonTechFest – 7 tracks, 36 sessions, 29 speakers, 865 registered, 476 attendees
  6. October 13, 2007 – IndyTechFest – 5 tracks, 26 sessions, 16 speakers, 370+ attendees
  7. October 19 & 20, 2007 – TulsaTechFest – 16 tracks, 100 sessions, 67+ speakers, 870+ registered, 650+ attendees on the 19th, 400+ on the 20th
  8. November 10, 2007 – AlbertaTechFest – 3 tracks, 18 sessions, 15 speakers, almost 200 attendees

If there hasn’t been one already in your area, why not start one? There’s just a couple major differences between a TechFest and a CodeCamp – TechFest can be any thing technology oriented, Microsoft Exchange, Sql Server, Data Security, Project Management, etc, where as a CodeCamp is typically "developer centric". A TechFest can have sponsorship, vendors, etc. – why not have the funds to provide bigger prizes, T-shirts and just an all around bigger event?

www.TechFests.com will be up shortly ( it is currently redirecting to TulsaTechFest) to be the one stop location for locations, dates and details on any and all TechFests.

TulsaTechFest 2007 a Smashing Success!

This is my long over due post regarding this year’s TulsaTechFest. I have quite a few excuses like the long hours I worked on the MOSS and WSS projects mentioned in my previous post. Instead of spewing those, I will just try and post once a night until I get caught back up. I’m sure I’ll have to skip a few, but I should be able to catch up quickly enough.

Building off last year’s success for the first annual event with attendance then of approximately 360 on the Saturday only event, this year blew the lid off. This was our first attempt at charging and making it a Friday and Saturday event. We received overwhelming sponsorship support that we decided to refund the 200+ paid attendees and make the event free to all again. This pushed our pre-registration numbers to over 800. Organizers expected the actual attendance to be either evenly split or higher on Saturday and were surprisingly shocked. While we are still awaiting exact final counts, what we have so far is 650+ checked in on Friday and 400+ checked in on Saturday.  While facilities cannot be booked until after the first of the year, we are already tentatively planning the dates for TulsaTechFest 2008 to be Thursday, October 16th and Friday, October 17th. We do still plan to include some content on Saturday, October 18th, but will probably consist of some deep dive training.

Lunch for 650+ people on Friday was an interesting feat and we narrowly squeaked by with the largest Domino’s pizza order ever delivered at one time of 125 pizzas. We over compensated by ordering 175 pizzas on Saturday, then as we did last year, delivered the left overs to a nearby homeless shelter.

It was not surprising the event attracted so many people from surrounding states, considering we had 5 Microsoft employees presenting, over 15 Microsoft MVP’s, with a total of 69 speakers, and 100 sessions. Details can still be found at www.tulsatechfest.com and details from the 2006 event can now be found here: 2006.tulsatechfest.com.

Work – The new largest public MOSS site and another rocking WSS site!

My blog has been silent for longer than I would have liked, but for good reason. My announcement is now 4-6 weeks (at least) delayed, but we have pushed IMHO the largest public MOSS (Microsoft Office Sharepoint Server v3.0 2007) site live. FanU.com is a social networking site for collegiate football and basketball fans with a ton of unique features. Everyone who signs up has the ability to blog, upload photos and videos, plus bomb and praise others. We are still adding features, like forums, points (achieved through using the site) and games.

We put together an excellent team of 7-9 developers (with limited or no prior experience with Sharepoint) and pushed version 1 of the site in 3-4 months. They did a terrific job, as well as the designers and everyone else on the team.

Just two weeks ago now, we launched our second site using Sharepoint. This time using WSS (Windows Sharepoint Services v3.0 2007) – www.coxhelpcenter.com. If you are Cox Communications customer in the Oklahoma area then go there for your first level technical support questions and have them answered by the Virtual Cox Representative. They are pilot testing it in our area. If it achieves their goal of reducing the number of help center calls, they will increase the regions covered. This form of virtual interaction is a speciality of my employer www.winnercomm.com. They pushed their first one a few years back for www.NTRA.com as a Virtual Q & A (http://www.ntra.com/ntrau_index.aspx).

Calling all Architects and Class Designer users – Microsoft wants your feedback! See you at OKCodeCamp!

Microsoft has a survey regarding the features you want to see in the next update to the Visual Studio Class Designer! So provide it to them and help shape the future of this awesome tool by using the survey located here.

If you haven’t Registered yet at OKCodeCamp.com – do it now. Jason Zander – the General Manager of the .NET Framework Division at Microsoft is giving the keynote and Raymond Lewallen has lined up an awesome Agile/ALT.NET event with a few extras!