Friday, March 30, 2012

SharePint with a twist

I have an idea for a SharePint with a twist. I feel that at any conference, user group meeting, SharePint etc., I always end up talking to the people in the community whom I already know. While this is comfortable, I would see it as beneficial to meet some of the other people in the room. Somehow that rarely happens.

To promote this, I was thinking of setting up a SharePint with a speed-meeting part of the evening. This is something that is done at a business club I belong to, and I find it extremely valuable. The basic idea is that a timer starts, you find someone random to talk to one on one, and in 5 minutes, you move on to the next person. Everyone participates so it removes the 'weirdness' of talking to new people.

Let me know if you would be interested in such a SharePint event. If I get enough interest I will organize something in Amsterdam.

Wednesday, March 28, 2012

ASP MVC and SharePoint: Revisited

When I first wrote about integrating MVC and SharePoint, I wrongfully stated that one is limited to using MVC 2 and .NET 3.5. I was corrected by Rob Johnson (@bertyJobbo), and there have been numerous requests since to show how to use SharePoint with MVC 3. This post is all about work that Rob sent me, so all credit goes to him.

Here are the step by step instructions:

  1. Create a new MVC 3 project, note that you need to select .NET 4 in the dropdown

  2. Select your view engine and template type

  3. Once the project has loaded, right click on references and add a reference

  4. Select the SharePoint tab, and add the Client Object Model dlls

  5. Add a new controller

  6. Give the controller a name and choose any scaffolding you may want. Mine is empty.

  7. Add a using statement to the top of your controller code, to ensure the client dll is loaded

    using Microsoft.SharePoint.Client;

  8. Create the action method below, simply gets the title of the SharePoint site using Client Object Model.

            public string Index()
                ClientContext ctx = new ClientContext("http://demo.xcomplica.local");
                Web web = ctx.Web;
                ctx.Load(web, w => w.Title);
                string title = web.Title;
                return title;

  9. Run your site, and you should see your SahrePoint site title in your MVC3 app!