Showing posts with label sharepoint 2010. Show all posts
Showing posts with label sharepoint 2010. Show all posts

Sunday, October 23, 2011

SharePoint Site Template custom Navigation

Ok this should be simple. It should be straight forward. I should have known better.

Scenario: I'm building a SharePoint 2010 web template.
What I want to do: I want to display two links in the top nav (Home & Shared Documents). I want this navigation to be available as soon as the Site collection is created. There's an obvious place in the onet.xml file to place this. But this area is poorly documented. I had to do a bit of trial and error to achieve what I wanted.

This is the solution to my problem but I have spent way too much time to achieve something so simple.

<NavBars>
 <NavBar Name="$Resources:core,nav_Home;" Separator="&amp;nbsp;&amp;nbsp;&amp;nbsp;" Body="&lt;a ID='onettopnavbar#LABEL_ID#' href='#URL#' accesskey='J'&gt;#LABEL#&lt;/a&gt;" ID="1002" />
 <NavBar Name="SharePoint Top Navbar" ID="1002">
  <NavBarLink Name="Shared Documents" Url="Shared%20Documents/">
  </NavBarLink>
 </NavBar>
</NavBars>

"SharePoint Top Navbar" is the top navigation nav bar. If you want to add links to the top navigation you need to add them in this node.

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

Monday, November 22, 2010

SharePoint 2010: Web Part Properties

Even though I've made SP2010 web parts before for some reason I couldn't find any good articles on how to add Custom Properties to a web part.

So here is my take on a Custom SharePoint 2010 Web Part Property:
private string _targetSite = "SomeSite";
[Personalizable(PersonalizationScope.Shared),
WebBrowsable(true),
WebDisplayName("Target Site"),
WebDescription("Specify a site."),
Category("Configuration")]
public string TargetSite
{
get { return _targetSite; }
set { _targetSite = value; }
}

Oh and make sure you have the permissions to change settings.

Friday, October 29, 2010

SharePoint 2010: EventID 8306

I was given a pair of servers to install SharePoint 2010 on. I had been told all the necessary patches and hotfixes needed for SharePoint 2010 were installed.

After installing I couldn't get the User Profile to work... So I did a hunt through the event log and the following stood out.

Symptoms:
I get this in the Event Viewer:
An exception occurred when trying to issue security token: Method not found: 'Void System.IdentityModel.Selectors.SecurityTokenRequirement.set_IsOptionalToken(Boolean)'..

EventID 8306

Fix
Install this: KB976394

Lesson
Double check yourself that all patches, hotfixes, band aids and bandages are in place before doing the SharePoint 2010 installation. Small investment at the start can save you a lot of time.

Good luck with your SP2010 installs.