Sharepoint 2010 – Why is Text Layout Always Disabled?

Sharepoint 2010 uses the feature rich ribbon, similar to what was introduced in the Microsoft Office 2007 suite.  This ribbon provides users with many capabilities, such as text editing and content publishing.  Among these features is the ability to change the format of a rich text control, adding headers, footers and columns.

When designing a publishing site, I had hoped to make use of this neat feature to keep Page Layout designs simple and easy to update for content contributors.  However, when designing the publishing site, I noticed that I was unable to make use of this feature of the ribbon, as it was always disabled.

Researching the problem, I was having a hard time finding out why this button was disabled.  I checked security settings and the control properties in my Page Layout aspx file, nothing seemed to solve this dilemna.

It turned out, after asking on a Sharepoint forum, that the Text Layout feature is only available for wiki sites.  The Publishing Portal and Enterprise Wiki are built off of the publishing framework, which replaces the Text Layout button with the Page Layout button.

So custom layouts will have to be design specifically at the Page Layout.  If a layout requires 3 columns of data, then a Page Layout has to be created that allows 3 columns of data.  Lesson learned, I am providing this as a tip for anyone else having a hard time figuring out why they can’t use the Text Layout button in their Publishing site.

SharePoint 2010 Deprecated Types and Methods

If you are writing code for SharePoint 2010, please refer to the the link below to avoid calling deprecated APIs.

http://code.msdn.microsoft.com/sps2010deprecated/Release/ProjectReleases.aspx?ReleaseId=3304

  

Web Content Management System Checklist

Web Content Management (WCM) is the practice of creating, controlling and publishing web content using specialized tools.  The specialized tools are collectively know as a Web Content Management System or WCMS.   Most entities (business, municipalities, hospitals, etc) these days have some form of web presence, which is typically a dedicated website.  Most people think of a website as a collection of static web pages.   This was the case five or six years ago, but today most websites have functional requirements that go well beyond a simple What You See Is What You Get (WYSIWYG) website.   I have worked with several customers who still use technology that is focused on simply creating and publishing web pages.  However, the customer’s needs always go well beyond simply pushing HTML pages onto the web.  This post is intended to provide a checklist of features you should keep in mind, before deciding on a WCM solution.

Drawing

Drawing

  1. End User Contribution – Does the WCMS support contribution by end users (i.e. non web masters, programmer, designer types)?  These days, one of the quick value adds of a WCMS is that it frees up your technical resources from updating a web page.  The most basic feature of a WCMS system is to give knowledge workers the ability to update web pages.
  2. Approval Workflow – Does the WCMS support approval workflow?  You want your end user’s to contribute directly to the website, but any edits made to the site may need to be vetted by a manager or subject matter expert first.  After all, people do make mistakes.
  3. Security - Does the WCMS allow users to be given access only to specific sections of a website?  The website editing process is typically most successful when users are given responsibility for specific pieces of a site.
  4. Asset Reuse -  Does the WCMS allow web site assets, such as code pages to be reused across the site?  When dealing with static web pages, its common to copy and paste an existing page, then make a few small changes  to suite your needs.  However if common code needs to be modified, that change needs to be made for every static page in the web site where it can be found.  Any respectable WCMS will allow you to create and define important assets once, and reuse them multiple times.  For those of you ASP.NET developers, think Master Pages.
  5. Publishing - Does the WCMS system allow for publishing of a site from an internal (within your company’s intranet) ‘Contribution’ instance to an external (outside the firewall ) ‘Consumption’ instance.  Whenever possible, I recommend to my clients that they use two WCM systems, one for editing and the other for consumption.
  6. Web Application Integration – Does the WCMS  integrate with or is it capable of  hosting web applications?  For instance, you may already have a web application that allows job applicants to submit a resume, check the resume for viruses, and pass it along to a hiring manager.  How will your WCM system integrate with this existing application?  The company I work for has a relatively straight forward website, but it has several web forms that have been integrated into our WCMS.
  7. Web Application Stack – Which web application stack does the WCMS use, Java, .NET, Cold Fusion?  If you already have a significant investment in .NET web applications, then using a Java based WCM system may not be the best course of action.

This list is by no means exhaustive, but it gives you a good idea of the features that should be included in any WCMS you choose.

Tyson Magney
Senior Developer
ImageSource, Inc.

Share on Twitter

Hello World Feature in Windows SharePoint Services 3.0

Let’s go back to basics and see how to create a simple custom feature in WSS.  I assume you already create a WSS site or have access to one.

Creating HelloWorldBasic Project

Navigate to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES and create a new folder HelloWorldBasic

Creating feature.xml File

Create a feature.xml file with the following info

<Feature xmlns=”http://schemas.microsoft.com/sharepoint/”
  Id=”3C3B6DE6-8FA6-4b8e-9CFD-62EA67057F76″
  Title=”Hello World Feature”
  Description=”My custom feature”
  Scope=”Web”
  Hidden=”FALSE”
  ImageUrl=”menuprofile.gif”>
  <ElementManifests>
    <ElementManifest Location=”elements.xml”/>
  </ElementManifests>
</Feature>

Creating elements.xml File

In the same folder, create a new file and called it elements.xml with following info

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>   <CustomAction
    Id=”SiteActionsToolbar”
    GroupId=”SiteActions”
    Location=”Microsoft.SharePoint.StandardMenu”
    Sequence=”100″
    Title=”Hello World”
    Description=”My custom menu item”
    ImageUrl=”_layouts/images/menuprofile.gif”>
    <UrlAction Url=”
http://imagesourceinc.com”/>
  </CustomAction>
</Elements>

Installing HelloWorldBasic Feature

Open the command prompt and execute the commands as shown below

image

You should see a successful msg

Activating the Feature in WSS

Open your favorite browser and navigate to your WSS site.  From there hit Site Actions | Site Settings | Site features and hit the Activate button

clip_image001[6]

You can run your custom feature now by going back to the Site Actions menu

clip_image001[10]

 

Hope this helps.

Phong Hoang
Development Manager
ImageSource, Inc.

Share on LinkedIn   Share on Twitter

SharePoint Event Handlers

A while back, I found myself in a situation where I assumed MOSS Document Libraries were capable of creating thumbnails from images.  After all, MOSS creates thumbnails of images for Picture libraries.  It turns out this was a bad assumption.  This feature had been promised to a customer, so I had to find a solution.

Enter MOSS Event Handlers.  Event Handlers allow developers to hook into the MOSS event model and run custom code when MOSS performs a specific action. In my case, I used the SPItemReceiver class to create a thumbnail of an image when it was added to a document library.  There are Event Handlers for Sites, Lists and List Items.

Here is a short sample of EventHandler code that will override the ItemAdded, ItemUpdate and ItemDeleting methods.

using Microsoft.SharePoint;
namespace ImageSource.EventHandlerExample
{
  public class ListItemEventHandler : SPItemEventReceiver
  {
    public override void ItemAdded(SPItemEventProprties properties)
    {
        //Called when an item is added to a list.
    }
    public override void ItemUpdated(SPItemEventProperties properties)
    {
      //Called when an item is updated, this method is also called with an item is added.
    }
    public override void ItemDeleting(SPItemEventProperties properties)
    {
        //Called when an item is deleted from the list.
    }
  }
}


For my solution, the ItemAdded method grabs the image that was uploaded, creates a thumbnail, and adds the new thumbnail rendition to another library that shadows the library with the pictures.  ItemDeleting removes the thumbnail from the 'shadow' library. ItemUpdated is empty, but I left the method in my code in case it was needed at a later time.

Hopefully, this example gives you an idea of how SharePoint can be extended using Event Handlers.  The ability to hook into SharePoint's event model is quite powerful.  I wish more of the ECM systems I work with had a similar feature.

Tyson Magney
Senior Developer
ImageSource, Inc.

Share on LinkedIn   Share on Twitter

Windows SharePoint Services Tips

If you are working with the WSS 3 SDK, you may have noticed that some of the method names are confusing.  The reason has something to do with the legacy naming from the old SharePoint Team Services, but you can avoid the confusion by keeping the following terminology in mind when you are reading the WSS doc.

  • Site  = Site Collection
  • Web = Site
  • RootWeb =  Top Level Site

Below is a sample code that will hopefully clear this up.

SPWebService webService = SPWebService.ContentService;
SPWebApplicationCollection webAppColl = webService.WebApplications;

foreach (SPWebApplication webApp in webAppColl)
{
    Console.WriteLine("Web App Name = " + webApp.Name);
    SPSiteCollection siteColl = webApp.Sites;

    foreach (SPSite site in siteColl)
    {
        SPWeb web = site.RootWeb;
        Console.WriteLine("Top Level Site Title = " + web.Title);
     }
}

Hope this helps.

 

Phong Hoang

Development Manager

ImageSource, Inc.

Share on LinkedIn   Share on Twitter

Follow

Get every new post delivered to your Inbox.