Skip to main content

Blog

Go Search
Home
Blog
Playground
Code Snippets
TweakSP
Contact Me
  

www.iwkid.com > Blog
Kris Nyreen spotlighted on Spaghetti Code Podcast!

Kris Nyreen (of Branding SharePoint fame) was recently spotlighted on the Spaghetti Code podcast.  You can hear Kris (the devigner) speak on designing and developing with Silverlight on the podcast here:

http://slickthought.net/post/2008/08/Spaghetti-Code-Podcast---Seeing-the-Silverlight-with-Kris-Nyreen.aspx

A look ahead

Here's a quick look at some events coming up in the next few weeks:

Back from Vacation

This was my fourth year taking a fishing trip up to Canada and this year we visited Sesikinaga Lake.  The trip was fantastic!  Aside from being 190 miles north of International Falls (and therefore, TOTALLY disconnected from the world and internets), the fishing and wildlife were phenomenal.  Here are a few pictures:

P8260024 P8260026

P8260053 P8260058

 P8270089 P8280115

P8280137 P8300216

One of the highlights from my trip was seeing a caribou swimming across the lake:

http://www.youtube.com/watch?v=4yqtgewlb-s

Just amazing!  Now I'm back and refreshed and ready for the crazy weeks ahead!

SharePoint Beagle and the Data Form Web Part

For the past few weeks I've been working with the fine folks over at the SharePoint Beagle to post my first article in a four-part series dedicated to the Data Form Web Part.  If you don't already subscribe to the Beagle, definitely check it out!

You can get to the article here.

August MNSPUG - Bring your questions!

This month's Minnesota SharePoint User Group will be a little different - we'll have an open panel discussion with a number of people on hand to answer your questions!  We'll also have Todd Klindt on hand to answer some of the really tricky questions!

Join us Wednesday the 13th!  More information available at the MNSPUG Web Site:  http://www.sharepointmn.com

<Update>We had an awesome turnout and got really good feedback!  It sounds like we might try to do this format of meeting more often (every 3-4 months perhaps?)  Thanks to everyone who brought questions and a BIG thanks to Todd for making the drive up from Iowa!</Update>

July 2008 MODIG

I'll be presenting at tonight's Minneapolis Office Developer Interest Group!  Tonight's topic is Developing with SharePoint Remotely - NO OBJECT MODEL ALLOWED!  It is one of my favorite topics and I'm looking forward to some good questions!  For more info, check out http://www.sharepointmn.com/MODIG

See you there!

<Update>Slides and resources available here</Update>

Day Dreaming - 7 weeks till Canada!

I got an email today referencing some posts on my old blogs talking about Lil' Shab Lake.  For the past 3 years I've taken an annual trip up to Ontario for a week (my only week each year) of fishing.  In 7 weeks I'll be heading up again and, thanks to Aaron's email this morning, I can't seem to think about anything else today!

Here are some pictures from my first two trips, both to Lil' Shab:

Lil Shab 1 Lil Shab 2 shab01 shab02 shab03 shab04 shab05 shab06

The SPWeb PropertyBag

For those of you not familiar with the PropertyBag, it is a place to store metadata or properties for your web sites in SharePoint.  Much like the term "SharePoint," "PropertyBag" actually can refer to two things on the SPWeb object:

Properties - a SPPropertyBag object

AllProperties - a hashtable

I've always used Properties when setting metadata for web sites but I've heard lots of people lately saying that AllProperties is the better place to put things.  The difference is Properties actually returns a subset of AllProperties.  As long as you are consistent with how you are adding/accessing the metadata, you can use either one.

So - why would you use the property bag?

  • Add additional context for your site - if you are on a project site, add the matching id from your LOB systems.  Web Parts can then read that data, connect to your LOB system and return relevant information.
  • In SharePoint, each web doesn't have a web.config to put configuration values in.  The property bag is a nice place to store configuration variables.

So - how do I use the property bag?

  • There is no out of the box web interface to manage property bag values on a SharePoint web site
  • Thanks to Corey, I now know how to manage the property bag in SharePoint Designer!  I can't believe I haven't seen this before:
    PropertyBag 
  • You can use PowerShell to display properties:
    PoSH PropertyBag (view)
    and update properties:
    PoSH PropertyBag (edit)
  • Obviously if you can update the PropertyBag in PowerShell, you can also update them via Web Part, Feature Receiver, etc...
Tag Cloud for SharePoint Blog Sites - Part 2

Now that we've got a list of all the categories and the number of posts per category we can start looking at what else we need for a tag cloud.  Jon's post contains a formula:

8 + (8 * (1 + ((S-A)/A))

For our purposes:

S is the number of posts for the current category.

A is the average number of category "flags" per post.  To be clear, I've configured my Posts list to support checking multiple categories - so I can't just use the number of Posts to determine my average.

*hang on, this is where it gets a little crazy*

To help get our values, I created a few XSL Templates:

The first should look familiar.  I've turned what we worked on in the last post into a template:

Get Post Count By Category

 

Now, the next one... ouch.  Essentially, I needed to add up all of the posts per category.  The problem is, XSL doesn't support a running total concept.  You can only declare a variable once and then it is what it is - no updating.  So, the answer to our problem?  Recursive template calls:

Count Category Flags

To call the CountCategoryFlags, I have another Template:

Get Total Category Flags

So - to step through it:

  • I'm sending in an index of 1 and a total of 0 to the CountCategoryFlags template
  • That comes in to CountCategoryFlags and we call GetPostCountByCategory using the title of the indexed item in the Categories list
  • Then, as long as the index isn't the last in the Categories list, we call CountCategoryFlags again this time passing in:
    • the current index + 1
    • the current total (0) + the number of CategoryFlags we got earlier
  • Once we get to the end, we are returning the last value of total which should be the number of category flags in all of our posts.

Still with me?

Now we can assign two variables:

Total and Average

The TotalCategoryFlags simply wraps our GetTotalCategoryFlags.

The AveragePostsPerCategory does the math to give us the average posts per category!

 

Now we can start looping through our categories again.  For each one, we'll want a local variable to store the number of posts for that category:

Category Count

Then we can actually use the formula Jon gave us:

Category Weight

Once we have the category weight, we can dump the output:

Category HTML  

And that's it!  There are two things I parameterized:

  • BaseFontSize
  • CategoryListUrl

If you make those parameters in your Data View, you can actually change them pretty easily in the browser:

 Parameters

Parameters Edit 

And there you have it:

Tag Cloud

If you haven't already, you can download the .webpart file HERE and import it into your own blog site.

Tag Cloud for SharePoint Blog Sites - Part 1

I started off with a simple roll-up Data View that showed the number of posts per category:

image_thumb[2]

The first step is to create a linked data source.  To do that, choose Manage Data Sources from the Data View menu:

image

Next, create a linked data source by clicking "Create a new Linked Source" in the Data Source Library window:

image_thumb[5]

Then, select the lists you want to use:

image_thumb[7]

You then have a chose for how you want to link your data sources.  This defines the format of the XML when it comes back.  For today's purposes a join will work just fine:

image_thumb[9]

Now that we've got our linked data source, we can drop a multi-item view of the categories onto the page.  I then created a new column and went into the XSLT for that column:

image_thumb[4]

First I'm declaring a local variable called Category and assigning it the value of the current Title (remember, we're looping through Categories).  Next, I get a count of the all the posts where our Category is contained in the PostCategory field.  The main reason I'm doing a contains is because you can configure your Posts list to support multiple values in the category field.

The result is a list of categories and the number of posts that are in each category!  In my next post I'll expand on this example to create the Tag Cloud.

1 - 10 Next

 ‭(Hidden)‬ Admin Links