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 29, 2010

SharePoint 2010: BDC doesn't work with SQL 2000

I'm at a client site. They have data on a SQL 2000 DB. We want to expose this to SharePoint 2010. Sounds like a simple task of creating BDC connection. Great!

But no. Apparently there isn't support for SQL 2000 in SharePoint 2010 BDC.

Humph...

The discussion on the MSDN forum. (Look at the bottom).

Also worth a look at this article, specifically the comments: MSDN Article

Friday, November 26, 2010

Blog move

Hi everyone,
Just a quick note that I have moved my blog from http://soreeyesdotnet.blogspot.com/ to http://sharepointchan.blogspot.com/

All posts have been copied across and I will be keeping the old blog around in case anyone has links pointing to my posts.

Regards,
Chan

Monday, November 22, 2010

Colour coding text in Blog posts

I found this great site: http://www.hilite.me/

It will generate html for you so your code can be displayed in all it's colourful glory.

Loving it!

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.

Sunday, October 10, 2010

SharePoint 2010: Top Navigation on Search pages

To add the standard top navigation menu to your search pages you will need to either modify the out of the box (OOB) minimal.master or to create your own master page with the menu in place.

If you are going to modify the OOB file then please make a copy of the original first. Incase something goes wrong.

To add the menu to the minimal.master open up the masterpage. Insert this in a line above <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server" />
<!--Navigation-->
<div class="s4-pr s4-notdlg" id="s4-topheader2">
<asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
<SharePoint:AspMenu
ID="TopNavigationMenuV4"
Runat="server"
EnableViewState="false"
DataSourceID="topSiteMap"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
UseSimpleRendering="true"
UseSeparateCss="false"
Orientation="Horizontal"
StaticDisplayLevels="2"
MaximumDynamicDisplayLevels="1"
SkipLinkText=""
CssClass="s4-tn"/>
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
<Template_Controls>
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
id="topSiteMap"
runat="server"
StartingNodeUrl="sid:1002"/>
</Template_Controls>
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
</asp:ContentPlaceHolder>
</div>
<!--End of Navigation-->

Public holidays

Having public holidays in your calendar is a very common request of clients.

Microsoft does provide a way of adding public holidays to your Outlook calendar: http://blogs.msdn.com/b/outlook/archive/2008/01/18/adding-holidays-to-your-outlook-calendar.aspx

You can then export these calendar items and then import them into a SharePoint calendar. All great and good.

But it came to my attention that Microsoft haven't quite got it right. There are a number of inaccurate holidays and missed holidays.

Adam Vero has kindly provided a fix for these dates http://blog.meteorit.co.uk/2010/09/03/outlook-2010-has-incorrect-holidays-for-uk-and-many-other-countries/

Thanks Adam.

SharePoint 2010: Contacts Web Database and search results

Minor issue but one that was raised by a client. After you create a "Contact Web Database" there are a number of files created which also get indexed. So they will appear in your search results but they really shouldn't. Again I'll have to investigate further to see if there is a way to exclude these items from the crawler or to not display them in the search results.

I wish I had more time to investigate these issues...

SharePoint 2010: Organisation Chart (Silverlight)

Ok my client asked me there was a way to show more data in the Org Chart control in SharePoint 2010.

The short answer is no. The control only shows:
Name
Position
About me

One way to get around this is to display more information in the About me field.

Or you could make your own org chart control (which I might do when I get a couple of days free).

SharePoint 2010 Workflows: String builder in Designer 2010

To add a string builder type of action to your workflows:
In a Step, type string and hit enter.
Add: "Extract substring from Index of String."
Add the text as per your requirements.
If you want the whole string you need to start at 1 (not 0).
Select your output and off you go.

Took me a little while to figure this one out so I thought I would blog about in case my memory fails me.

Wednesday, September 15, 2010

SharePoint 2010: Calendar bug when browser maximised

I've noticed that when you maximise the browser while viewing a SharePoint 2010 Calendar in the Monthly view. Items are not being resized correctly.

The correct functionality occurs when you resize the browser.

I've had a quick poke around SharePoint's javascript files. My best guess at this stage is the event to resize items is being called before the items are on the page.

I hope to get more time to investigate this and provide a solution in the next couple of days.

I tested this in IE 8.0.6001.18702 and Firefox 3.6.9.

Infopath 2007: Adding contact selector gives CoCreateInstance failed.

I've tried to add the contact selector to my dev environment. I followed the steps here:

http://blogs.msdn.com/b/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx

But at step 4 I get:

CoCreateInstance failed to create the control.
- The control may not be properly installed or registered.
- The control may have missing dependencies.
- Only controls implemented as InProc servers (.DLL or .OCX) are supported.

Solution:
I ran an "Office Diagnostics..." and it fixed the issue.

In Infopath 2007: Help > Office Diagnostics...

At least I think this is the fix. I have been tinkering with my system in attempts to fix this. If it works for you please comment here to confirm.

I think there might have been a new version of the ContactSelector.dll control installed somehow and Infopath 2007 didn't like it.