Thursday, April 24, 2008

SharePoint Explorer View Not Working?

Does the "Open with Windows Explorer" menu item not work on a document library?

Make sure that the "WebClient" service is started. By default, it's disabled in Windows 2003.

Wednesday, April 16, 2008

Passing Arguments to Silverlight Web Parts

Here's how you can pass values to Silverlight applications embedded inside of a (SharePoint) web part.

As an example, consider the HelloSilverlight example from the recently posted Silverlight for SharePoint Blueprints. We want to allow users configuring the web part to specifiy who is being greeted.

Create a browsable public property inside of the HelloSilverlight2 web part (HelloSilverlight2.cs).

private string name = "Gaylord"; // default value

WebDescription("The person who is being greeted."),
public string Name
get { return name; }
set { name = value; }

Set the InitParameters property of your instance of
System.Web.UI.SilverlightControls.Silverlight. Specifically, add the following line of code to HelloSilverlight2.CreateChildControls().

silverlightControl.InitParameters =
string.Format("Name={0}", Name);

Note: if you have multiple parameter to pass, separate each key/value pair with a comma.

Go now to method Application_Startup() of your Silverlight application (App.xaml.cs). Extract the Name parameter from the StartupEventArgs instance passed as an argument to Application_Startup().

string name = e.InitParams["Name"];

For the HelloSilverlight2 app, we want to pass in the value for Name to the instance of Page. Therefore, we'll create a new contructor for Page

private string name;
private string displayText;

public Page(string name)
InitializeComponent(); = name;
displayText = string.Format("Hello {0}!", name);
HelloWorldTextBlock.Text = displayText;

and invoke the new constructor (instead of the old parameterless constructor) inside of Application_Startup().

this.RootVisual = new Page(name);

For completeness sake, you'll want to modify TextBlock_MouseLeftButtonUp() to use the value of displayText.

Tuesday, April 15, 2008

SharePoint New Icon

For the ump-teenth time, I've been asked "how long does the new graphic persist on a new document or list item"?

Well, according to this guy the answers are:

"How long does the New! icon display after I add an item?" and "How do I prevent the New! icon from displaying?"

The New! icon displays for 2 days by default, but you can use the command line to set that:
[SharePoint Bin Directory]\stsadm.exe -o setproperty -propertyname days-to-show-new-icon -propertyvalue [Days to Display] -url [Your Virtual Server's URL]

To hide the New! icon, set [Days to Display] to 0. An alternate and unsupported approach is to replace the New! icon with a clear gif file.

The only problem with this answer is that it always takes me 10 minutes of searching to find it. But, I just fixed that problem by posting here... :-)

Silverlight SharePoint BluePrint Samples Not Working?

Having trouble getting the new Silverlight and SharePoint examples working? Turns out that you're not alone.

Help is available here and here.

In a nutshell, you need to fix some typos in various scripts, make sure the necessary runtimes are installed, update web.config and (whew!) add a new MIME type to IIS.

Saturday, April 12, 2008

One Year Later...

And this blog is still here. Crazy...