April 2011 - Posts

I’m absolutely excited to be speaking again at SharePoint Saturday Houston this year on May 7, 2011.  This event put on by the great people at H-SPUG is one of the most well executed community events in the country.  Props go to @Victor_Chat and all of the sponsors, volunteers, speakers, and other people that make this event happen.  With over 500 people expected, you know this will be a great event to learn more about SharePoint.  I’ll be giving my Intro to SharePoint Development talk where I’ll be hopefully converting numerous new people to the dark side.  :) 

I’m looking forward to seeing some old faces there as well as meeting some new ones.

This event will be located again at the Norris Convention Center – City Centre (803 Town & Country Lane, Houston, TX 77042).

We’ll see you there!

Follow me on twitter.

#SPSHOU

Whenever you use the Blank Site template for a site collection, a lot of supporting features that you may want are not activated.  One of these is the feature for Managed Metadata site columns.  When you pick one, you might see the following error.

The required feature is not enabled for this column type.

image

That’s nice, but why don’t you actually tell me the feature name that I need to activate?  I’ve seen a lot of posts on this, and they state to activate the required feature using PowerShell using the GUID of the feature.  Some even, dare I say it, recommend you use stsadm.  Tsk. Tsk.  I don’t know about you, but I can’t remember the GUID off the top of my head.  I got tired of having to look up a post every time I need to activate this feature on a new site collection so I decided to figure out what the name was. 

If you’ve read my previous PowerShell posts, you know that we can figure this out with Get-SPFeature.  This told me that the feature name was actually TaxonomyFieldAdded.  Now all we have to do to activate is use the Enable-SPFeature command as you see below.  In my case, I am activating it at the site collection located at http://sp2010/sites/deployment.

Enable-SPFeature -Id TaxonomyFieldAdded –Url http://sp2010/sites/deployment

image

If all goes well, you’ll get a blank prompt back indicating success.  Now when you try to create your managed metadata site column, it should work successfully.

image

Even if you’re not great with PowerShell, I find that this command is pretty easy to remember.  Try it out.

I had been told from the beginning that you can create “simple” public facing websites with SharePoint Online / Office 365.  However, I had never seen the setting a place to create the public web site in the beta until recently.  If you go to tenant administration (located at https://yourname-admin.sharepoint.com) and go to the Site Collections page, there is a new option under the New button in the ribbon.

image

Clicking on the button, presents you with a dialog asking you about your new public website.  There are quite a few options to configure so let’s take a look at them.

image

After you provide a Title for the site you are asked to provide a URL for the public site.  However, by default, the only option you have is http://yourname-web.sharepoint.com. However, you can use your own name if you configure your DNS settings in the Office 365 administration page.  I’ll just use the default URL here for today.  You are then also prompted for a default language and time zone.   Further down the screen you will see a few more options which are required.

image

You must provide an administrator for the site and then you also have to provide a storage quota and resource usage quota.  These require values, so I usually just put in 1000 for each.  It’s hard to know at this point how many “resources” a typical site might need.  Hopefully, there will be some official guidance on this at some point.  Once you do say ok, give it a few minutes to create your new site collection.

image

When it’s finished provisioning your site collection, you’ll see it in the list.

image

You are now ready to check out your new public facing web site with SharePoint Online.  What does it look like?  Take a look at the image below or go to http://sbti-web.sharepoint.com and check it out for yourself.

image

As you can see it actually creates a simple site with a Page Library.  It actually looks nothing like SharePoint either.  Clicking on the Member Login link takes you to the Page Library itself where you can edit the pages.

image

Clicking on one of the pages allows you to start editing.

image

One issue I did have is that even though I am an administrator I can’t see all of the administration options in the Site Actions menu.

image

I’m not sure if this is a bug or by design.  I’ll probably post something in the forums and ask.  However, you can still get to the Site Settings page by going to /_layouts/settings.aspx.  Here, you can get to the solutions gallery, master pages, features, etc..  You should be able to brand the site just like you would any other SharePoint site using SharePoint Designer and / or sandboxed solutions with Visual Studio 2010.

image

That’s a quick look at the public facing site options with Office 365.  From my understanding, this is meant for simple public sites and not the equivalent of FIS.  I think if you try to build a site or hundreds of thousands of users per day, you’ll quickly exceed your resource quota.  However, it’s great for simple brochure type sites that are easy to manage.

I’ve been living under a rock and I didn’t hear the news that Red Gate was discontinuing the free version of .NET Reflector until the last week or so. I’ve used a Red Gate product or two in the past and enjoyed them. ANTS Performance Profiler has saved my butt a few times by identifying slow performing ASP.NET code. It was a real life saver. They make some decent products.  It’s too bad it has come to this.

I’m absolutely shocked that Red Gate is discontinuing the free version of reflector. However, I have to say I was equally shocked when I heard that they bought it to begin with. I never understood it from the business perspective. I’m glad Lutz got something for the hard work that he put into it. However, why would a company buy a free community tool thinking they were going to being able to capitalize on it?

.NET Reflector has always had an auto update feature. You can currently decline the update right now and still run it. However, the current version is time-bombed. Once June 1st comes around, the update becomes required and you have to update to the latest version. Once you have the latest version, your time is limited to the trial. After that, you have to pay up.  The same version you had for free now costs you $35 US.

Red Gate’s original approach seemed to be that they’ll keep the tool in the community for free and then develop it further with Visual Studio integration as a value-add in the Pro edition. The issue being that the value-add simply doesn’t add that much value, so of course they had issues getting people to buy it. The fact is the free edition of the product met your needs most of the time. Usually, you open it up, pick a class or two to examine and then you’re done. The Visual Studio integration and debugging features sounded good in theory, but personally I had mixed results with it and found that the decompiling process took quite some time. It just wasn’t worth messing with. I have heard some others report that they enjoy the feature though so maybe it’s worth it to some.

I understand that business is business. Red Gate invested money into buying the product and they need to recoup it. This deal should have never been made though. Whoever convinced the executives at Red Gate that they could profit off of this deal has probably been fired or will soon be when this whole endeavor further damages the reputation of the company  The community is not happy.. The product itself is quite strong but people are accustomed to not paying for it so they are not about to start. The value-add features in the Pro editions are just not worth paying for.

So what can Red Gate do? Write it off. Take it as a loss and terminate whoever brought the deal to the table. Apologize to the community for making such a huge mistake and hope it doesn’t affect their other product sales. Take a look at their forums, the citizens are revolting.  A promise was made to the community and now it has been broken. They justify the need to charge because they have a development team to pay. The product doesn’t need a whole team of developers. Keep in mind, the product was basically maintained by one person for years. Commit to doing some updates with a small development for the good of the community but give up on trying to monetize the product. Consider making it open source and let the community take over. Red Gate needs to make the right decision now, before it affects the sales of your other products.

What can you do? If it bugs you enough, stop using Red Gate products. Take a look at the up and coming ILSpy. Don’t bother posting in their forums. People have done that to death and it’s not going anywhere. I think the best bet is to e-mail them at this point. As an MVP, I could probably get a copy of Reflector Pro for free. However, I won’t do that as a matter of principal. I’ll do without or try some other tools out. I write this today, because I feel like I represent part of the community. This blog had 39k page views last month. Maybe my voice has a chance of being heard and I can help make a difference.

To date, I’ve written a few posts on issues that may occur when you are looking to create a search center.  Sometimes the site template isn’t present or you receive an error.  I recently encountered another issue with the FAST Search Center.  The site template was present on the root site collection but it wasn’t present on another site collection.  I decided to do some investigating to figure out what the cause was.

image

I decided to go take a look at the XML files for the site templates in 14\TEMPLATE\1033\XML.  There I looked for the file that was most likely search related which happened to be webtempsrch.xml.  I saw a listing for all of the usual site templates including one for the FAST Search Center.  When I examined the configuration, I noticed that there was an attribute called VisibilityFeatureDependency as you can see in the snippet below.

<Template Name="SRCHCENTERFAST" ID="2000">

<Configuration ID="0" Title="FAST Search Center" Hidden="FALSE" ImageUrl="/_layouts/images/template_fast_srch_cen.png" Description="A site for delivering the FAST search experience. The welcome page includes a search box with two tabs: one for general searches, and another for searches for information about people. You can add and customize tabs to focus on other search scopes or result types." DisplayCategory="Enterprise"  VisibilityFeatureDependency="5EAC763D-FBF5-4d6f-A76B-EDED7DD7B0A5" >

  </Configuration>

</Template>

The next step was to determine what that feature was so I opened PowerShell and issued the following command.

Get-SPFeature –id 5EAC763D-FBF5-4d6f-A76B-EDED7DD7B0A5

SearchExtensionsFeaturePowerShell

It references a feature called SearchExtensions.  It’s responsible for deploying the Visual Best Bet web part among other things.  To enable the feature I just used the Enable-SPFeature command that I have talked about before using the URL to my site collection.

Enable-SPFeature –Id SearchExtensions –url http://sp2010/sites/deployment

image

Once I enable that feature, I go back to the site collection and use the New Site menu and sure enough there is my FAST Search Center.

image

I have my FAST search center back now and that is good, but I have never had an issue with this before.  I decided to check another farm.  In the above case, I was using February 2011 CU.  I went back and checked my RTM build.  I started by opening webtempsrch.xml again.  It took me a second, but I realized that the feature GUID is different as shown below.

<Template Name="SRCHCENTERFAST" ID="2000">

<Configuration ID="0" Title="FAST Search Center" Hidden="FALSE" ImageUrl="/_layouts/images/template_fast_srch_cen.png" Description="A site for delivering the FAST search experience. The welcome page includes a search box with two tabs: one for general searches, and another for searches for information about people. You can add and customize tabs to focus on other search scopes or result types." DisplayCategory="Enterprise"  VisibilityFeatureDependency="8581A8A7-CF16-4770-AC54-260265DDB0B2" >

  </Configuration>

</Template>

That GUID listed in the RTM file (8581A8A7-CF16-4770-AC54-260265DDB0B2) is for the PremiumSite feature not SearchExtensions like I showed above.  I took a look at the dates on the files and I noticed that webtempsrch.xml has a date of 1/19/2011 on the February 2011 CU build.  The previous date was 1/9/2010.  They changed it.  I’m not sure why it changed, but I’m going to consider this a minor bug and will be reporting it.  At least it’s easy to work around. 

It’s generally pretty easy to create a Search Center or FAST Search Center site.  However, on a new installation, there are a few features you need to activate (especially if you are using blank site) that are easy to forget.  I’ve talked about not being able to find the Enterprise Search Center site template before.  That is caused by not having the SharePoint Enterprise Site Collection feature activated.  Another error you might encounter is the following.

An unexpected error has occurred.

image

This occurs when you have not activated the SharePoint Server Publishing Infrastructure site collection feature and you try to create an Enterprise Search Center or FAST Search Center.  I’ve seen inconsistent results here though.  Sometimes, you will actually get a useful error message like the one below.

image

This tells you what you’re clearly supposed to do.  I really haven’t determined why you get one error message over the other, but if you get an error creating your Search Center, you know the first thing to check.  This post from the SDK also reminds you of which features to turn on.  As I said before it’s easy to forget to turn on these features, so I hope this helps if you run into this error.

You know by now that the cloud is hot and Microsoft says “we’re all in”.  That being said, there has never been a better time to push all of those chips forward and  jump on the bandwagon.  It’s time to get some experience with SharePoint Online / Office 365.  I know most people don’t have access to the Office 365 beta yet, but when it opens up, you should sign up for the public beta and start getting familiar with it.  If you haven’t seen SharePoint Online yet, check our my previous article which gives a quick tour of it.  I plan to write more about SharePoint Online in the future, so I figured the best place to start is with an introductory development article on building and deploying a web part.  My past series on building and deploying web parts to 2010 and 2007 are still the most popular articles on DotNetMafia.com.  Let’s take what we learned there and see how we deploy web parts to the cloud.

Before we get started, let’s reiterate what we’re working with.  With Office 365, your development scenario involves sandboxed solutions.  As you know, these solutions are deployed to the site collection level and offer a restricted subset of the SharePoint API.  If you are already confortable working with sandboxed solutions, you are in great shape to begin SharePoint Online development.

What does the development environment look like?  Well, you know that SharePoint 2010 VM you already have?  You’re looking at it.  Just like Azure, SharePoint Online development also used the “Over the fence” development methodology.  Meaning, you develop your code locally and then throw it over the fence and hope it works.  This may sound bad, but it’s really not a big deal and the Azure people have been doing it for a while.  AppFabric is close to Azure, but there is always a possibility of differences when you get it in the cloud.  As long as you build a sandboxed solution and don’t make use of unsupported features (i.e.: PerformancePoint, BCS, etc), more than likely your code will work when it gets to the cloud.  There may be things that you can do in a Sandboxed solution in SharePoint 2010 compared to SharePoint Online, but it’s far too early to tell at this point.  To get started developing web parts in the cloud, you pretty much need a copy of SharePoint 2010 (or SharePoint Foundation) installed somewhere locally.  This could be native on your Windows 7 machine or inside a virtual machine.  Wherever it is, you will obviously need Internet access to get your code to the cloud.

To get started developing in the cloud, the first step is to build the web part on your local SharePoint environment.  I won’t go through all the steps here, because most of them are the same from my article on 2010 Web Part Development.  However, I will go through the important steps.  The first step is to create a new Empty SharePoint 2010 Project in Visual Studio 2010.  Specify the URL to a local site on your SharePoint server.  Don’t use the address of your SharePoint Online site.  It won’t work.  When prompted for the solution type, choose Sandboxed Solution.

SPOVisualStudioSandboxedSolution

At this point, you have a regular SharePoint project in Visual Studio.  Add a web part to the project just like you would in SharePoint 2010.  Sticking with the Hello World type example, we put some code like the following in our web part.

using System;

using System.ComponentModel;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint;

using Microsoft.SharePoint.WebControls;

 

namespace SharePointOnlineProject3.HelloCloudWebPart

{

    [ToolboxItemAttribute(false)]

    public class HelloCloudWebPart : WebPart

    {

        protected override void CreateChildControls()

        {

            Controls.Add(new Label() { Text = "Hello, Cloud!" });

        }

    }

}

At this point, we can test our code locally on our SharePoint server.  Build and deploy the project and then add your web part to a test page on your site.  Again, if you aren’t familiar with these steps, take a look at my Building and Deploying Web Parts with SharePoint 2010 post. If the code, works you should see a similar page like the one below.

SPOHelloCloudWebPartLocal

Now, we’re ready to send our web part “to the cloud!”.  How do we do that?  Start by using the Package menu to build a SharePoint package (.wsp file). 

SPOVisualStudioPackageSolution

This creates a .wsp file located in the bin folder of the project.  We’ll use this file to deploy our web part to the cloud.  It’s now time to open up a browser and connect to your instance of SharePoint Online.  Once you get there, we deploy a sandboxed solution just like we would on-premises.  Go to Site Settings –> Solutions to view the Solutions Gallery.  Click on the Solutions button in the ribbon, and then click Upload Solution.  Browse to the bin folder of your Visual Studio project and select the file ending in .wsp.  Once it uploads, be sure and click the Activate button. 

SPOSolutionActivate

Now, you just need to ensure the feature is activated by going to Site Settings –> Site Collection Features.  If it is not activated, click the activate button.

SPOFeatureActivated

Your web part has now been thrown over the fence and deployed to the cloud!  Test it out by going to any page on the site and adding the web part to the page.  You’ll find your web part in the Custom section by default.  If all goes well, your web part should work here too.

SPOHelloCloudWebPartCloud

Congratulations, you have now deployed code to the cloud!  It’s really not that hard is it?  Now, you might be wondering if you can debug your solution.  Unfortunately, the answer is no.  If you have an issue, you have to step through it locally on your on-premises SharePoint server.  That’s all there is to getting started with SharePoint Online development.  As you can see it’s very familiar to sandboxed solutions development with your on-premises server.