jQuery Random Quote Viewer

While doing some housekeeping recently on my personal site I was tinkering around with a pre-jQuery ajax enabled web part I had written to display random quotes from a SharePoint list on the site. The code was pretty ugly so I decided to adapt the web service call to use jQuery instead in line with the similar functions displays I’ve been deploying lately.

I thought I might take the time to share it as well since jQuery is still a hot topic.

Here is what the display looks like.jQuery Random Quote Viewer

The SharePoint list is a basic list with a column for the Quote and a column for the Author.

The code is currently hosted in a Content Editor Web Part (CEWP) and is pretty simple stuff. If you are going to use this, just be sure to put in the name or GUID of the list and the URL to the site’s list web service. Here is what it looks like:



$(document).ready(function() {
var URL = ""; // URL ex. http://mycompany/sites/sub-site/_vti_bin/lists.asmx
var listName = ""; // List Name or GUID

var soapEnv = "


" + listName + "





";

$.ajax({
url: URL,
beforeSend: function(xhr) {
xhr.setRequestHeader("SOAPAction",
"http://schemas.microsoft.com/sharepoint/soap/GetListItems");
},
type: "POST",
dataType: "xml",
data: soapEnv,
complete: DisplayQuote,
error: function(xhr) { $("#errorContainer").html('Error: ' + xhr.status + ' ' + xhr.statusText); },
contentType: "text/xml; charset="utf-8""
});
});

function DisplayQuote(xData, status)
{
var Output;
var WikiString = "http://en.wikipedia.org/wiki/Special:Search?fulltext=Search&search;="
var xmlDoc = xData.responseXML;
var ListItems = xmlDoc.getElementsByTagName("z:row") || xmlDoc.getElementsByTagNameNS("*","row");
var SelectedItem = Math.floor(Math.random()* ListItems.length);
var Quote = ListItems[SelectedItem].getAttribute("ows_Quote");
var Author = ListItems[SelectedItem].getAttribute("ows_Author0");
Output = "" + Quote + " - " + "" + Author + "";
$("#quoteContainer").html(Output);
}

While this is simple code, it can be applied to so many different things.  You can use it to generate a slide show, show random images, etc. 

The source files are available here:

 

Related Links

My Sites in the Enterprise: Today and Tomorrow

As we inch closer to SharePoint 2010 and the vast improvements made to the My Sites feature set I thought it might be time to revisit some key concepts when looking to leverage My Sites in an organization.  In many organizations I see My Sites as still under deployed and under utilized.  In some cases it is because leaders do not know what to do with it while in others they are not sure how to support it.  I hope to address both of those issues here along with offering some other advice.  By addressing the topic now I hope that business can get a jump on implementing the tools based on the current technology as well as bring it to the forefront of the 2010 upgrade planning so that they will be able to better leverage the tools in the years to come.

What is the purpose of My Sites?

In its simplest form, My Site is a SharePoint site collection owned by an individual giving them the ability to have both personal and shared content.  It also includes the bases for many personalization features including a Colleague tracker, My Links, and the ability to aggregate content like tasks and documents they are involved with throughout the entire farm.  Since the sites can be automatically provisioned in most environments it takes little or no IT interaction for a user to get started.

In some environments the the feature is limited to IT and some power users, while in others the service is available but its benefits have never been communicated to the organization as a whole.  By widening the audience and its participants more value can be derived from the tools.

Enterprise 2.0

These tools are a good foundation for an Enterprise 2.0 strategy helping your users find and communicate with each other.  In most organizations people are already using these types of tools, but they are doing it for different purposes and with tools hosted outside your company’s network.  Look at LinkedIn, Facebook, and Twitter which probably already have unofficial groups or networks organized around your company.  By pulling some of this into your network you can expand productivity around internal information assets, provide some level of information security, and increase the overall socialization activities.

In a recent post I wrote about Overcoming Obstacles in SharePoint and Ent 2.0 which addresses a few of the biggest issues; Fear of Change, Information Power, and Lack of Interest.

Governance

Like most SharePoint topics we cannot have a full discussion without mentioning Governance.  Oddly enough, this is one area that I think perhaps can be over governed.  The cornerstone to Social Computing is social interactions and for it to be social there needs to be room for an individual’s creativity.  That isn’t to say that anything goes, but in many cases things should be generalized into more of an appropriate use policy. 

Personal Photo – One of the most personal aspects of personal computing is the individual’s photo or avatar.  Hopefully within an organization people feel comfortable enough to have a photo or at least an avatar.  While a photo of the person is great it probably shouldn’t be a requirement and hopefully isn’t their mug shot from the badge or security system. 

Dressing up the My Site – The individual should be allowed to change the theme to personalize the color scheme and select a personal icon or banner for the site.  Even if the rest of the SharePoint sites are fully branded with the corporate identity, small things like this can really increase the interest level since it gives them a chance to be creative and truly gives them ownership of the site. 

Quotas – Quotas should be set at a reasonable amount.  Too little and users will end up going back to Shared Drives which will undermine use of the tool.  Of course too much and there is the possibility that storage costs can escalate quickly along with backup and recovery times. 

If used appropriately it should draw down the storage requirements in email and shared drive storage thereby just shifting storage from one system to another.

Taking it to the Next Level

SharePoint 2010 will add in both the Facebook “Wall” concept as well as some enhanced social bookmarking, both of which have been painfully missing from the 2007 offering. 

While both of those features are welcomed additions, there are more opportunities to extend the system as well.  One of the things I like best about systems like Facebook and LinkedIn is there are all kinds of tools that have been created to help interact with the platforms.  This includes everything from mobile browsers to make posting updates easier to the LinkedIn Outlook Toolbar that can expose user’s LinkedIn profile, status, and network information in Outlook.  The Outlook team has responded by offering the Outlook Social Connector which promises to offer an extensible provider platform for integrating with multiple social platforms including SharePoint 2010 as well as Windows Live and anyone else that can create a provider. 

Other extensions and tools are still needed though.  In the past I wrote a bookmarking component that supported adding items to My Links from both inside of SharePoint as well as other ASP.NET applications.  As soon as I get a handle on the final features of SharePoint 2010 I plan on updating that and making it available as a project on CodePlex.

Simple content components like a Quote of the Day or slide shows can also increase the personalization of the system. 

Isn’t this for Business?

This is for business, but it can still be fun.  Increasing the fun factor will get people to be more engaged and interactive.  Also, it is a proven fact that teams that know each other at a personal level and can maintain relationships function at a higher level.

Related Posts

Overcoming Obstacles in SharePoint and Ent 2.0

One of my favorite general IT blogs is Michael Krigsman’s IT Project Failures blog.  Michael provides a balanced view with great insights into the failures of many organizations.  These are lessons that every implementer, integrator, or system stakeholder should pay attention to.

In a recent post titled Resistance to change:  The real Enterprise 2.0 barrier Michael discusses some of the challenges to implementing Ent 2.0 systems.  As always it is a great and relevant read, but I think it matches much of my experience with implementing SharePoint in the Enterprise.  The top obstacle listed was Resistance to change.  The capabilities of the tools are not the biggest limiting factor, user adoption is.  Some of the reasons discussed include fear of change, the power of information holders and lack of interest.

Fear of Change – This is a natural human response.  Much has been written about how to drive change in an organization, but I think the most critical technique is end user involvement.  When people are involved they are much more likely to have a positive view of the change and you are more likely to value insight into how things are actually done in practice. 

This also provides a good opportunity to fine tune your feedback collection techniques so that all stakeholders continue to have a voice after go live. 

Information Power – In some organizations there is a culture in place where people feel like they have to be a gateway to information.  With the recent economical downturn people are all the more desperate to be seen as irreplaceable.  Organizations need to work towards transparency and openness.  A positive side effect of this is better use of the subject matter or domain experts who are normally over worked in closed organizations and frequently have to answer the same questions repeatedly.

Lack of interest – Lack of interest can definitely have an impact on the life of a system.  Some users still do not understand or have any interest in Ent 2.0 systems.  I think easiest way to get passed this is to show sustained value.  It is easy to establish and maintain interest with small groups, but it gets exponentially harder as the size of the group increases.  Keep the tools current, and show incremental advances to keep stakeholder interest.

I’ve also seen turnover in key positions or management impact a groups use of these tools.  It is important to work with the new stakeholders to review what is there and what can be done to align it with any changes to the group’s direction.

Closing

I’m always interested in hearing feedback.  Do you agree, disagree?  Have any other tips to decrease the resistance to change?

Related Posts

%d bloggers like this: