Look at me


October 11, 2013 - 16:12, by Steven Van de Craen - 0 Comments

Hey you, look at me! I’m a blog. A SharePoint blog would you believe it? Don’t I look fancy?

A new design

For the last few weeks the incredible Tom Van Bortel has been working on a new blog design for this blog. A task I wouldn’t dare to commit myself to, I have very little design skills. But he does!

The result is a modern look, clean and slick, and hey it’s even responsive! Go ahead and play with that browser window and make it smaller and wider Winking smile Very nifty feature thanks to Bootstrap.

If you’re interested in the very details on how the design was formed just drop me a line and perhaps I’ll ask Tom to do a guest post. Or ask him yourself directly, his coordinates should be on his own blog.

SharePoint or CKS:EBE ?

My blog is indeed hosted on SharePoint, but it really still is CKS:EBE that does most of the rendering using the MTF (Modular Theme Framework). Actually I couldn’t upgrade the blog to native SharePoint 2013 mode because of the CKS:EBE customizations, so it is running in SharePoint 2010 mode on our SharePoint 2013 farm. One day I’ll have to upgrade to SharePoint vNext since I doubt they’ll support both 2010 and 2013 modes.

» More posts on CKS:EBE

Content transformation

In order for the images to be ‘responsive’, I had to add a CSS class “img-responsive” to all images in all posts. The blog posts were SharePoint List Items, so this should be an easy enough task to automate via PowerShell or .NET code. I’m still more fluent in .NET than PowerShell so I wrote up a quick application to transform all existing blog posts to have responsive images.

You can go different approaches here, but I chose the Html Agility Pack so I could manipulate the HTML as a queryable, adaptable HtmlDocument. This is very similar to the System.Xml.XmlDocument and it’s very “tolerant” when it comes to malformed HTML.

Here’s the quick and dirty code from my transformation script. I didn’t focus on writing clean code here, it’s just a one off.

using HtmlAgilityPack;
...

public static void Run()
{
    string url = "http://www.sharepointblogs.be/blogs/vandest/lists/posts";
    using (SPSite site = new SPSite(url))
    {
        using (SPWeb web = site.OpenWeb())
        {
            SPList list = web.GetList(url);

            foreach (SPListItem item in list.Items)
            {
                string oldBody = (String)item["Body"];
                string newBody = ModifyHtml(oldBody);

                item["Body"] = newBody;
                item.SystemUpdate();
            }
        }
        SWF.MessageBox.Show("Done");
    }
}

public static string ModifyHtml(string inHtml)
{
    string result = null;

    HtmlDocument doc = new HtmlDocument();
    doc.LoadHtml(inHtml);

    foreach (HtmlNodeNavigator imgNodeNav in doc.CreateNavigator().Select("//img"))
    {
        HtmlNode imgNode = imgNodeNav.CurrentNode;
        HtmlAttribute classAttr = imgNode.Attributes["class"];

        if (classAttr == null)
        {
            imgNode.Attributes.Add("class", "img-responsive");
        }
        else
        {
            string classAttrValue = classAttr.Value.Replace("img-responsive", String.Empty).Replace("  ", " ").Trim();
            classAttrValue = String.Concat(classAttrValue, " img-responsive").Trim();

            classAttr.Value = classAttrValue;
        }
    }

    using (StringWriter sw = new StringWriter())
    {
        doc.Save(sw);
        result = sw.ToString();
    }

    return result;
}

Writing posts

I’m still a loyal user of Windows Live Writer for writing my posts. I like the Edit/Preview/Source modes, the WYSIWYG style of writing up a blog post, and also the plug-ins. For now I’m using Insert Code for code snippets and Dynamic Template. The latter is really cool since you can create your own snippets using HTML, JavaScript and ASP.NET and offers a lot of potential. The author has put up some basic tutorial videos that might interest you and will get you started.

So now it’s up to me again to start blogging more frequently. No more excuses now Winking smile


Blog migration to SharePoint 2013 - Part 2


January 21, 2013 - 12:44, by Steven Van de Craen - 8 Comments

Here’s a second post regarding the upgrade of my old SharePoint 2007 blog to a newer SharePoint version. Right now I’m running my blog on our new SharePoint 2013 infrastructure in SharePoint 2010 modus (deferred Site Collection upgrade).

CKS:EBE

I deployed the original SharePoint 2007 WSP to the SharePoint 2013 farm and lo and behold, it all seems to work just fine. I am missing a feature icon on the Web Application Features page, but that doesn’t matter.

The HttpModule and all other things seems to keep working, even in a Claims environment. Just one thing that needs fixing and that’s the MetaWeblog publishing API. It seems that in the current pipeline of the HttpApplication the claims stuff hasn’t finished initialising or whatever, but right now I get an error when trying to publish new blog posts from Windows Live Writer.

I’m working on a fix for that.

Content Upgrade

Since it was SharePoint 2007 I had to first upgrade that to SharePoint 2010 using DBATTACH. That gave the usual warnings but no big issues.

After that upgrade I noticed some views didn’t have the checkboxes for selecting multiple items. I fixed that in code by recreating those views, see more here:

» Upgrading SharePoint - Some views not upgraded to XsltListViewWebPart

I then attached the “SharePoint 2010” content database to our new SharePoint 2013 farm but didn’t do the Site Collection Upgrade yet. The deferred Site Collection Upgrade is really nice and seems stable. Not sure if there are any recommendations on moving ‘as soon as possible’ to a native SharePoint 2013 experience…

The biggest bonus I got from upgrading from SharePoint 2007 is that I can delete multiple spam comments at the same time using multiselect + delete Smile

Mobile View

I thought all was well (for now) but then I visited my blog on my phone and it gave me the mobile view. Sure I know you can append ?mobile=0 but that didn’t cut it for me.

I just went on disabling the Mobile View entirely for the Web Application, which can be done through the web.config (amongst other ways).

Here’s a nice PowerShell script that does that for you:

» Disable SharePoint Mobile View with PowerShell

Next steps

I will continue to work on the blog upgrade. I would like to fix the MetaWeblog issue, add some sort of image stealing protection, create a new design or work on closing the gap with the out of the box SharePoint 2013 experience.

Oh, and the blog is now available on an additional URL (which may be the single address in the future):

» http://www.sharepointblogs.be/blogs/vandest

Cheers!


Blog migration to SharePoint 2013 - Part 1


January 2, 2013 - 21:33, by Steven Van de Craen - 1 Comments

I’ve been working during my spare time on upgrading our environments (intranet, extranet, blogs) to a brand new SharePoint 2013 platform. For the blogs this means I have to DBATTACH my content from SharePoint 2007 to SharePoint 2010, and then from SharePoint 2010 to SharePoint 2013. I’m also running CKS:EBE, a really cool community addon for SharePoint to give you just that extra (pretty urls, CAPTCHA, Modular Theme Framework, and the likes).

First I want to see how my content migrates between the different environments.

SharePoint 2007

Posts

Comments

SharePoint 2010

Posts

Comments

Note that the above screens were taken using a backup of my blog data from a few weeks ago, so some newer comments and posts aren’t showing.

SharePoint 2013

Posts

Comments

Result

The result is what you might expect from a DBATTACH upgrade, a full fidelity upgrade.

Post

Next step will be to upgrade the CKS:EBE code. I might decide to create a light version with just the functionality that I’m using on my blog.

Stay tuned!


Blog upgraded to CKS:EBE 3.0


July 24, 2010 - 12:40, by Steven Van de Craen - 0 Comments

The smart people behind the Community Kit for SharePoint have released 3.0 of the Enhanced Blog Edition. Check out the improvements it brings: http://cks.codeplex.com/releases/view/28520

Cheers !


CKS:EBE 2.0 Final Release


March 14, 2008 - 09:14, by Steven Van de Craen - 1 Comments

CKS:EBE 2.0 has been released since a few days ! Check it out here:

http://www.codeplex.com/CKS/Release/ProjectReleases.aspx?ReleaseId=5134


Blog updated with CKS:EBE


December 27, 2007 - 20:42, by Steven Van de Craen - 0 Comments

In case you noticed my RSS feed acting weird; I was updating the CKS:EBE version (currently version 2.0 Beta 2) on my blog. One of the downsides when running alfa/beta software I guess. But it's never been an issue so far. I have so far really enjoyed working on this community project.

The latest version is almost ready for release (keep an eye out on http://www.codeplex.com/CKS for further details !) and includes a lot of bug fixes and performance improvements.

  • Easily deployable solution file (.WSP) with Features that can be activated or deactivated
  • Modular Theme Framework ("MTF")
  • Protection for anonymous access to 'System Pages'. This means anonymous users cannot access /lists/.aspx, /forms/.aspx, /_layouts/*.aspx
  • MetaBlogApi working a bit better...You will need to create a Picture/Document library called Media for it to upload images.
  • Support for Akismet comment spam detection
  • Multiple categories/tags can be mapped to each blog entry/post
  • Anonymous comments can be moderated
  • CAPTCHA Validation for reducing spam comments
  • Name and URL fields in comments
  • Friendly URL ("FURL") for the blog's posts
  • Friendly URL for the blog's RSS feed
  • Support for CKS:TagCloud web part (being released separately)
  • Configurable settings
    • Enable content caching
    • CAPTCHA validation on comments and contact forms
    • Enable post trimming
    • Lock down system pages
    • Akismet key spam validation
    • Set specific blog theme (as the default)
    • Custom RSS feed (e.g. from Feedburner)
    • Enable Theme Selector (so users can select their own theme)

Could you have told that this blog was running on Windows SharePoint Services 3.0 ?