Sep 222010

Get the preferred search center url from the MySite settings of your SSP

 

When creating some custom MySite code we wanted to link back to the searchcenter from my MySite but instead of using a webpart property we wanted to create our links the same way SharePoint does in the original MySite: with the “Preferred Search Center” location in the MySite Settings of your SSP. In the end it took me more time to find this property and a way to access it because it’s a non-public property so I thought it was worth a post seeing as I didn’t find anything else online for this.

 

//Get your current context (or the context of the SSP in question if that’s not the one your running in)

ServerContext current;

current = ServerContext.Current;

 

//Get the UserProfileApplication

object userProfileApplication = current.GetType().GetProperty("UserProfileApplication", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(current, null);

 

//Get the canonicalSearchCenterUrl

string preferredSearchCenterUrl = ((string)userProfileApplication.GetType().GetField("canonicalSearchCenterUrl", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(userProfileApplication));

 

Grtz,

Tom

Published: 9/22/2010  8:13 PM | 0  Comments | 0  Links to this post

Sep 022010

SharePoint 2010 : Sandboxed visual webpart is possible!

 

As probably many of you have been told it’s not possible to create a visual webpart within a sandboxed solution. I know when I heard this it was a real downside and didn’t really make me enthusiastic about using this kind of solution. But, there’s a spark on the horizon, some people have already figured out how to work around this drawback!

 

I first noticed the possibility when working with the SharePoint 2010 Dev tools for visual studio from Codeplex but their template just simply doesn’t work. Of course now my curiosity flared up and I kept looking until I came across this great blogpost by Stefan Stanev which explains step by step how to achieve a sandboxed visual webpart + gives a downloadable sample project (POC) .

Now this project probably won’t work immediately, it will build but will show error’s when you try adding the webpart because it has this post-build script (postbuild.ps1) which uses specific hard coded locations. Be sure to install the ILMerge tool (free Microsoft download here) to this location - C:\Program Files (x86)\Microsoft\ILMerge.

 

This sure got me thinking about sandboxed solutions again, hope it will convince you too!

 

Gr

Tom

Published: 9/2/2010  9:35 PM | 0  Comments | 0  Links to this post

Sep 012010

SharePoint Developer Tools for Visual Studio 2010

 

Found a handy new add-in for Visual Studio 2010 on CodePlex here called SharePoint Developer Tools for Visual Studio 2010. It’s a work in progress as I found out not all their templates are 100% but I think there are some useful and timesaving templates/features in there!

 

Gr

Tom

Published: 9/1/2010  7:42 PM | 0  Comments | 0  Links to this post