If you haven’t been living beneath a rock in the last two days, you probably heard the news we released the SharePoint 2013 Preview and Office 2013 Preview. Since there is already a massive amount of content available on blogs, TechNet  etc. I’m not going to add even more with this blog post. My goal is simply to give you a limited amount of resources to quickly get you up to speed with all the news.

First of all, there was the announcement two days ago by Steve Ballmer. It was broadcasted live, and you can watch it on demand again. It takes 1h, it’s entertaining, shows some high level demos (mainly of Office 2013) and is a good starting point of your exploration.

 

Office

  • (If you are a developer, skip to the next bullet point!) After watching the announcement, you probably want to install the Office 2013 Preview. Just go to http://www.microsoft.com/office/preview/ and sign up, it’s super-easy, free and the streamed install takes less than a minute. The nifty thing is that while the installation is finishing (takes like 5 to 10 minutes), you can already start the Office clients!
  • If you are a developer and want to build apps for Office or SharePoint , I’d recommend to sign up for an Office 365 Developer Site. It includes a subscription for the Office clients too! An Office 365 Developer Site is a preconfigured SharePoint 2013 Preview site that you can use to create, test, and deploy apps for Office and SharePoint. You can deploy the "Napa" Office 365 Development Tools development tools to this site to get started developing SharePoint-hosted apps, and apps for Office documents and mail items, even if you don't have Visual Studio 2012 and SharePoint development tools in Visual Studio 2012 installed on your developer computer.
  • After you have signed up for the Office 365 Developer Site, you can familiarize yourself with the new apps for Office and SharePoint.
  • A good introduction to the “Napa” Development tools can be found on Jason Zander’s blog. Also check out the Build apps for Office article on MSDN.
  • When you want to learn more about the Office 2013 Preview features, I’d recommend to check out Office for IT pros and/or What's new in Office.
  • When you want to learn more about developing for Office 2013 Preview, check out the Developer training.

 

SharePoint

So quite a list of links and this is just a tip of the iceberg! If you feel I missed an important link just drop a comment or contact me. Also follow me on Twitter, when you want to read when I find interesting content.

Yesterday I had the pleasure to attend and present at the SharePoint Saturday Belgium edition. The Belgium Information Worker Usergroup (BIWUG), who organized the event, deserves a big round of applause; they hosted around 200 enthusiastic SharePoint people on a free and fun event. Of course a big thanks also goes to the numerous sponsors: Xylos (for making their great infrastructure available), AvePoint, Beyond-it, Metalogix, K2, Microsoft, Spikes, Ventigrate, Aurelium, Axceler, CTG, Idera, RealDolmen, Webtrends, and Wrox.

On top of that Karine and Andy released their first public beta version of the brand new CAML Designer tool (think of it as newer, stronger and better successor of the U2U CAML Builder). You can find it on the BIWUG site.

You can get my PowerPoint presentation about the SharePoint Designer below. See you all next time, or on one of the next BIWUG meetings!

I’m pretty sure everybody who is using SharePoint has sent a link to a document in a Document Library to somebody else (in an email message for example). So you probably know that links to documents (or list items) can become pretty long if the document is located in a Document Library on a site deeply buried in a hierarchy. SharePoint is of course not the only platform having this “issue” and the internet already solved it quite some time ago with URL shortening. From Wikipedia:

URL shortening is a technique on the World Wide Web in which a Uniform Resource Locator (URL) may be made substantially shorter in length and still direct to the required page. This is achieved by using an HTTP Redirect on a domain name that is short, which links to the web page that has a long URL. For example, the URL http://en.wikipedia.org/wiki/URL_shortening can be shortened to http://bit.ly/urlwiki or http://tinyurl.com/urlwiki. This is especially convenient for messaging technologies such as Twitter and Identi.ca, which severely limit the number of characters that may be used in a message. Short URLs allow otherwise long web addresses to be referred to in a tweet. In November 2009, the shortened links on one URL shortening service were accessed 2.1 billion times.

So to make a long SharePoint URL short, you can copy the URL to the clipboard, got to a URL shortener, past the long link over there and copy the short URL you get in return back to the clipboard. Works perfectly, but there are quite some tedious steps to go through. Already a long time ago, when SharePoint 2007 was still the rage, I posted some code that automates all these steps. Finally I found some time to update the code to SharePoint 2010 and nicely package it in a Sandboxed Solution, so it works both for SharePoint 2010 deployed on premises as in the cloud on Office 365. The result looks as follows, in the Documents tab of every Document Library, a new item is added to the Share and Track group (the button gets enabled when one document is selected):

When the Get Short Link button is clicked, a call to the Bit.ly URL shortener is made. The short URL is returned, together with a QR code, in a dialog for easy copy/pasting:

You can download the solution (.WSP) from the Get Short Link for SharePoint CodePlex site for easy deployment. Over there you can also find the complete source code, so feel free to enhance and improve! If you feel like sharing back, let me know and I’ll try to include your enhancements in the project. A couple of remarks:

  1. I used the Bit.ly URL shortener because it has a nice API and some cool features (like the QR code generation). You can adjust the source code to use your own Bit.ly account or even another shortener.
  2. The code uses the jQuery Javascript library (because I’m still a lazy developer and I still love jQuery a lot). The latest version of jQuery is included in the solution and automatically deployed.
  3. The solution and the source code are provided “as is” and without warranty of any kind. So please test before you deploy it to your mega big and important SharePoint site. It works on my machine(s). :-)

Side note: if you still follow this blog after a long period of blog-silence: thanks for your patience and welcome back. I won’t make any promises but I really would like to pick up blogging and start contributing again to the fantastic SharePoint community. Feel free to send some comments to encourage me. :-)

Check out the live agenda and find out why you should attend TechDays 2011. Review the sessions and speakers and build your own personalized agenda. Today we already have more than 1200 registrations. Don’t lose time and register now before the event sells out! If you are attending, feel free to drop by and say hi during my SharePoint & jQuery session. :-)

image image 

If you haven't decided yet, we give you more than just a few reasons
why you should not miss this event.

Developer Opening Keynote
We are happy to announce Scott Hanselman will be joining TechDays 2011 for the developer Opening Keynote this year.

The Main Conference

During the main conference on April 26th and 27th, six Developer and IT-Pro tracks bring you a mix of new technology and in-depth content on current technology with over 60 technical sessions planned.
With the full agenda now published, you can filter sessions and build your personalized agenda for the event.

Deep Dives (post-conference)

On the third day of TechDays, on April 28th, we host a Deep Dive day with four different tracks for developers and IT-Professionals. As a developer you can choose between two tracks that go in-depth and focus on Best Practices : Visual Studio Application Lifecycle Management and Cloud (Windows Azure). As an IT Professional you have the following two options : Virtual Desktop Infrastructure (by Corey Hynes) or Direct Access (by John Craddock).
Next to learning there is also the networking aspect of this conference. We give you the opportunity to connect with Product Managers from Redmond, meet your peers, talk to our user groups and much more.

Don't wait to register before it's too late!

PS. You can also follow the TechDays on Twitter and/or Facebook.

Last week was a very special week for me: I delivered my last course as a U2U trainer. I’ve been a full-time U2U employee for almost 7 years. During that time I had the opportunity to travel the world, meet lots of interesting people and make many new friends, while talking about Microsoft technologies. In the last couple of years my focus was mainly on SharePoint, but in my “early” years I was quite active with BizTalk, ASP.NET … as well. My career at U2U had many, many heights: having a drink while watching the sunset over the Kilimanjaro, strolling over Sunset Boulevard with my colleagues, speaking on large conferences in Belgium, Amsterdam, Barcelona, Milan, seeing the Northern Lights in Iceland …, and many, many more. But probably what I’ll remember most will be my dear coworkers: I count each one of them as a personal friend and every single one of them is an expert is his or her domain. I was incredibly lucky to have the privilege to be one of the U2U gang. Of course my time at U2U also had some lows, especially the time after we had to say goodbye to our colleague and co-founder Patrick Tisseghem who suddenly passed away. But, while never forgetting Patrick, we continued with our work and I think I may say we did quite well (especially Wim, our Director who managed to lead us through some rough times)! So I’d like to conclude with a big thanks to all the people who attended one of my courses (I never counted them, but you are probably more than 1000!) and who I worked with in the past years. And of course a big thanks as well to the U2U gang: I wish you all the best and keep up the good work.

So, what’s my next big adventure? Well I’m very happy that I’ll join Microsoft BeLux (Belgium & Luxembourg) as a Technical Sales Professional, of course for SharePoint and related technologies. So for all the people I’ve met in the past years, including my former colleagues, this is not a final farewell but I’m very sure we’ll all meet again!

Yesterday evening Scott Guthrie announced that Microsoft’s contributions to the jQuery Javascript library were accepted as Official jQuery plugins. One of those contributions is the jQuery Template plugin that allows you to do (up to a certain level) something like data binding similar to the approach we know from Silverlight. The idea is to create a template (think HTML snippet with elements bound to data properties) and data bind that template with an array of objects. You can find the API documentation over here, or you can check out Boris Moore’s excellent Getting Started guide.

So how can we leverage this in SharePoint 2010? Well jQuery Templates are a great match for either the SharePoint 2010 ECMAScript/Javascript Client Object Model, or the SharePoint 2010 REST API. The following example shows how to quickly display a list of Tasks on a page, by only using jQuery and the REST API in SharePoint 2010. Let’s start with a very basic Site Page that puts an empty ul element in the PlaceHolderMain Content control (notice the ul element gets a specific id set):

<%@ Page MasterPageFile="~masterurl/default.master" %>
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <ul id="tasksUL"></ul>
</asp:Content>

Next, we need to put some script references in the PlaceHolderAdditionalPageHead Content control to load both the jQuery library and the jQuery Templates plugin. For now this plugin is a separate .js file, in the next release of jQuery this plugin becomes a part of jQuery itself. (The demo code assumes that both .js files are deployed to the same location as the Site Page.)

<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <script src="jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="jquery.tmpl.js" type="text/javascript"></script>
</asp:Content>

After the script references (also in the PlaceHolderAdditionalPageHead Content control), we need to define our template, also using a script element that has the type attribute set to text/x-jquery-xml. This template is just an HTML snippet that gets created for every object of the array that gets “data bound”. In the template it’s possible to use references to those object’s properties by using template tags. For example ${Title} will get the value of the Title property of the object that gets “data bound”. In the sample below, I’m defining a template that’s basically an li element which displays some properties of a SharePoint Task item. Notice that to display the Description of the Task, I’m using the {{html}} Template Tag, because Description is a Rich Text Field thus it contains HTML itself.

<script id="tasktemplate" type="text/x-jquery-tmpl">
    <li>
        <b class="ms-rteFontSize-4">${Title}</b> - ${StatusValue}
        <div>{{html Description}}</div>
    </li>
</script>

Finally, in a new normal script element (once again in the PlaceHolderAdditionalPageHead Content control), we can use jQuery’s getJSON function to make an async call to the REST API. The getJSON function takes as a parameter a URL to call, which will be the URL of the listdata.svc (= REST API end point) that fetches all Tasks that are not yet completed. The last parameter of the getJSON function is a callback function that will use the jQuery Templates mechanism to build a new li element for every retrieved Task item, based on the template we defined above. This is accomplished by using the new tmpl function, called on the template. The return value is an array of DOM elements, which are added to the empty ul element, defined above.

<script type="text/javascript">
    $(document).ready(function () {
        $.getJSON(
            "../_vti_bin/listdata.svc/Tasks?$filter=StatusValue ne 'Completed'", null,
            function (data) {
                $("#tasktemplate").tmpl(data.d.results).appendTo("#tasksUL");
            });
    });
</script>

Once the Site Page is deployed, the result will look as follows:

 

If you’re interested, I’ve created a (slightly enhanced) sample Visual Studio project that’s a Sandboxed Solution (download here, including source code). This project provisions the required .js files, and the Site Page. On the demo Site Page I’ve used the following template:

<script id="tasktemplate" type="text/x-jquery-tmpl">
    <li>
        <b class="ms-rteFontSize-4" style="cursor:pointer;">
            ${Title}</b> - ${StatusValue}
        <div style="display:none">{{html Description}}</div>
    </li>
</script>

Notice that the div element that shows the Description value, is using the style display:none; so initially the Description value is not being displayed. In the callback function, after the li items are built, I’m using jQuery’s toggle function to show and hide the Description div when the corresponding Title is clicked.

$("#tasktemplate").tmpl(data.d.results).appendTo("#tasksUL");
$("#tasksUL li").toggle(
    function () {
        $(">div", $(this)).show("fast");
    },
    function () {
        $(">div", $(this)).hide("fast");
    }
);

When the Sandboxed Solution is deployed and activated, just navigate to the demo page using the URL http://yoursite/TemplateDemoAssets/demopage.aspx. You’ll see a nicely animated list of Tasks that are not yet completed!

If you’re an avid reader of this blog, you probably now that I’m quite a big fan of the jQuery Javascript library, especially in combination with SharePoint sites. For a while I’ve been trying to find a mechanism to deploy jQuery and add a reference to it on all SharePoint pages of a site, by just using a Sandboxed Solution. The first part, deploying the jQuery file, is really easy; this can be done in a Module in a SharePoint project. The second part was more of a challenge; making sure the jQuery file got referenced in all pages of a SharePoint site. My initial thought was to do this by using the AdditionalPageHead Delegate control, but it’s not possible in a Sandboxed Solution (you need to deploy the .ASCX to the SharePoint root). My second thought was to use the new ScriptSrc attribute you can use in a CustomAction (I wrote about this attribute some time ago). But initially I was under the impression that the ScriptSrc attribute could only target Javascript files loaded from the SharePoint Root (the \LAYOUTS) folder, resulting in a no-go for a Sandboxed Solution as well. Daniel McPherson stumbled upon this issue as well, but neatly solved it using Javascript to add the reference dynamically.

But apparently you can make use of the ScriptSrc attribute to reference files from the Virtual File System (e.g. a Document Library in a site) as well! (thank you Frederic Dobon for mentioning this!). The trick is to use the ~SiteCollection prefix in the ScriptSrc attribute, for example:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    ScriptSrc="~SiteCollection/SiteAssets/jquery-1.4.2.min.js"
    Location="ScriptLink"
    Sequence="10">
  </CustomAction>
</Elements>

It’s that easy! For your convenience I’ve uploaded the source code and the resulting SharePoint Solution (WSP file) to CodePlex.

SharePoint 2010 and Silverlight is a fantastic combination, especially when you use the Client Object Model for Silverlight to access SharePoint data. But maybe you’ve encountered the following situation: your Silverlight application works great when it’s hosted in the out-of-the-box Silverlight Web Part, but when you build your own custom Web Part to show the Silverlight Application it just doesn’t work anymore: the browser tells you there is an Error on page. The details of the error are: Unhandled Error in Silverlight Application Object reference not set to an instance of an object.

When you debug your Silverlight code, you’ll notice that the issue is that the ClientContext.Current is a Null Reference. To solution for this problem is that fact that if you want to use the Current ClientContext you need to add the MS.SP.url parameter to the initParams in the HTML object that loads the XAP. This MS.SP.url parameter needs to contain the URL of the site in which the Silverlight Application is currently being displayed. The code of your Silverlight Web Part could look as follows:

public class SLWebPartDemo : WebPart
{
  protected override void RenderContents(HtmlTextWriter writer)
  {
    writer.Write(string.Format(
      @"<object data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='100%' height='100%'>
         <param name='source' value='{1}XAPs/SLWebPartDemoControl.xap'/>
         <param name='initParams' value='MS.SP.url={0}/{1}'/>
         <param name='onError' value='onSilverlightError' />
         <param name='background' value='white' />
         <param name='minRuntimeVersion' value='3.0.40818.0' />
         <param name='autoUpgrade' value='true' />
         <a href='http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0' style='text-decoration:none'>
          <img src='http://go.microsoft.com/fwlink/?LinkId=161376' alt='Get Microsoft Silverlight' style='border-style:none'/>
         </a>
        </object>", SPContext.Current.Site.Url,
                    SPContext.Current.Web.ServerRelativeUrl));
  }
}

If you have developed Features for SharePoint 2007, you’re probably aware of a very serious limitation of Feature Development: upgradability. Deploying version 1 of your customization is no problem, but If you want to deploy a bug fix or additional functionality in version 2, you’re basically on your own. The good news is that in SharePoint 2010, this problem is solved: as a developer you can now build features that are upgradable. The basic concept goes as follows, you built your feature as usual, and optionally you’ve got the opportunity to specify what should happen when the feature gets upgraded from a previous version.

Chris O’Brian has written an excellent series of articles about this topic, so go to his blog to read the details:

Many SharePoint developers know that deploying your SharePoint customization to a SharePoint server often requires you to tinker the web.config of the sites where you’d like to see the customization in action. You can do these web.config modifications manually (not advisable), or automate them with the help of the SPWebConfigModification class from the Object Model. But quite often it’s not even necessary to use that class; when you deploy your customizations with the help of a Solution (.WSP file), like you should, the Solution deployment mechanism can modify the Web.Config to apply the most commonly used changes. This is defined in the Solution Manifest of the Solution file. The following Solution Manifest will add for example a SafeControl element for the current Assembly, which is required to display controls like Web Parts, User Controls etc. in the SharePoint sites.

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="684047e7-a990-4917-8a84-5d2ae5c8b1f3" SharePointProductVersion="14.0">
  <Assemblies>
    <Assembly Location="SafeControlsDemo.dll" DeploymentTarget="GlobalAssemblyCache">
      <SafeControls>
        <SafeControl Assembly="$SharePoint.Project.AssemblyFullName$" Namespace="SafeControlsDemo.EmptyElement1" TypeName="*" />
      </SafeControls>
    </Assembly>
  </Assemblies>
  <FeatureManifests>
    <FeatureManifest Location="SafeControlsDemo_Feature1\Feature.xml" />
  </FeatureManifests>
</Solution>

Visual Studio 2010 will automatically add the necessary SafeControl element to the Solution manifest when you add for example a Web Part item to the Visual Studio SharePoint project. But sometimes Visual Studio is not smart enough, or doesn’t have enough information to automatically do this for you. A pretty common scenario is when you build a CustomAction using the ControlClass and ControlAssembly attributes, pointing to a User Control that should be rendering the UI element defined in the CustomAction. In this case you explicitly have to add the required SafeControl element (for the User Control) to the Solution Manifest. As you probably know you can modify the Package.Template.xml to add the required SafeControl elemen, but you have to write that XML manually. A better idea is to use the power of the Visual Studio 2010 SharePoint developer tools, available out-of-the-box! The little trick is to select the item in your SharePoint 2010 project in the Visual Studio Solution Explorer window. The Properties window will show, for the selected project item, a property called Safe Control Entries.

When you click the ellipsis (the three dots), Visual Studio will show a dialog in which you can easily add the required SafeControl entries. Visual Studio will even fill out default values for you, referencing the assembly of the current project. As a result, the Solution Manifest will be updated with the corresponding XML (you can verify that by opening the Package item and selecting the Manifest view at the bottom). Easy isn’t it?

More Posts Next page »