Tuesday, December 14, 2010

SharePoint 2010: Getting all site collection tags

For those trying to figure out how to get the list of all tags out of SharePoint 2010 here ya go:

//Add these using tags at the top of your class.
using Microsoft.Office.Server.SocialData;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint.Portal.WebControls;

//This is the code neccessary to pull out all tags for 
//the current site collection.
SPSite site = SPContext.Current.Site;
SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileManager upm = new UserProfileManager(context);
UserProfile up = upm.GetUserProfile(false);
SocialTagManager stm = new SocialTagManager(context);
SocialTerm[] terms = stm.GetAllTerms();

Friday, December 3, 2010

SharePoint 2010: Silverlight Media Player

What can you do with the Out Of the Box (OOB) SharePoint 2010 Silverlight Media Player?

Well you can add it to the page.
Provide buttons to Pause, Play and Stop.

But they (Microsoft) haven't provided us with any player states. Is the media player playing a movie or has it stopped?

In my current project I need to do something once the movie has finished. Unfortunately after looking through the Silverlight code (after decompilation). I can see that there are no events to plug into.

Here are the relevent bits:
// Methods
public string CaptureCurrentFrame();
public void Pause();
public void Play();
public void Stop();

// Properties
public bool AutoPlay { get; set; }
public string DisplayMode { get; set; }
public string Duration { get; }
public long DurationMilliseconds { get; }
public string EmbedText { get; }
public bool Loop { get; set; }
public string MediaSource { get; set; }
public string MediaTitle { get; set; }
public int NaturalVideoHeight { get; }
public int NaturalVideoWidth { get; }
public string Position { get; set; }
public long PositionMilliseconds { get; set; }
public string PreviewImageSource { get; set; }
public string TemplateSource { get; set; }
public double Volume { get; set; }

What I'll try to do is to re-skin the player and perhaps do a little magic. If I have any success in this area I'll create a post.

In the mean time. This is a good article to see what you can do with this control: http://msdn.microsoft.com/en-us/library/ee558890.aspx