Archives / 2010 / May
  • SharePoint User Group Sweden May 2010 meeting recap

    Tags: SharePoint, Presentations

    This Wednesday the SharePoint User Group Sweden (#SSUG) had an awesome meeting sponsored  by Sogeti at Hotel Anglais in Stockholm. The event was sold out when announced in a few hours and we had to change conference room a few times at the hotel to fit everyone. More than 80 people showed up - our new record that we have to beat the next time.

    On the agenda for the day was first Christoffer von Sabsay (Sogeti) presenting about the Handelshögskolan SharePoint 2007 WCM case. A great presentation with a good deal of tips and tricks. MVP Göran Husman (Humandata) was up next presenting about the offline capabilities in SharePoint 2010 and Office 2010, also an interesting session with good insight how to combine Office, SharePoint Workspace and SharePoint for optimal flexibility. Last, but not least, I (Wictor Wilén, Connecta) did a session about SharePoint 2010 licensing and the related products. For me it was a good exercise to dig in to the gazillion options of SharePoint licensing.

    You can download the presentations here (all in Swedish):

    Thanks to all speakers, sponsors and to the attendees (especially those who shared a pint at the hotel bar :-)

    If you would like to speak, attend or host upcoming Swedish SharePoint User Group meetings - please contact me.

  • DIWUG SharePoint eMagazine 2nd edition

    Tags: SharePoint 2010

    SharePoint eMagazine The 2nd edition of the Dutch Information Worker User Group SharePoint eMagazine is out! It's a free SharePoint magazine, focusing on SharePoint 2010. The first edition released a couple of months ago was a fantastic opening issue with awesome content and It looks like this edition is keeping up the high standard. Looking forward to the series continuing...

    This issue contains some really interesting content ranging from an article about WCM in SharePoint 2010 from Waldek Mastykarz, CKS:DEV from Wes Hackett and feature/solution life-cycle/versioning by Anders Rask. And also an article about SharePoint 2010 Themes by yours truly.

    Happy reading!

  • SharePoint 2010 Sandboxed Web Parts does not support file uploading

    Tags: SharePoint 2010

    This is just a friendly reminder for you who tries to build a Sandboxed Web Part for SharePoint 2010 and trying to use the FileUpload or HtmlInputFile controls - it will not work. The uploaded files are not transferred to the sandboxed processes and cannot be used in the sandbox.

    The SharePoint 2010 sandbox runs in a separate process and all requests from the IIS to SharePoint are marshaled over to the User Code process. It is during this process the files that are uploaded during the request are lost - you will always see that HttpContext.Current.Request.Files.Count is equal to 0, or similar properties on the upload controls are set to null.

    For text or XML files it is quite easy to work around using other types of input fields (and optionally some JavaScript hacks).

    This is (probably) due to security issues - we do not want user code solutions to be able to upload malicious files to compromise the security.

    As always - this was learned the hard way...

  • Custom application pages in the SharePoint 2010 Sandbox

    Tags: Web Parts, SharePoint 2010

    The Sandbox in SharePoint 2010 allows Site Collection administrators to upload solutions in their Site Collections without access to the physical server. This is a great way to open up for creativity and for each Site Collection owner to expand the functionality of their Site Collection without adventuring the stability of the SharePoint farm. Sandbox Solutions do have some limitations, for instance we cannot add new Application Pages. Application pages are normally pages added to the _layouts folder, which are located in the {SharePoint Root}\TEMPLATE\LAYOUTS physical folder on each server.

    Application pages or similar are often used in different scenarios such as when you are building configuration or settings pages. I use them quite often and felt a bit limited with building Sandboxed solutions without them.

    Sandboxed solutions still allows us to upload Content Pages, that is pages that are located in a document library for instance. So one workaround is to build a Web Part containing the custom logic and a Content Page that contains this Web Part. Then deploy this to the Solution gallery in your Site Collection. And this is how to do it:

    Create a project

    Create a new Empty SharePoint 2010 project using Visual Studio 2010 and deploy it as a Sandboxed solution.

    Add a Web Part item

    Solution ExplorerThen add a new Web Part item to your project. Remove the Web Parts Control Description file (.webpart) and the Elements.xml file. We do not want to add the Web Part to the Web Part gallery, this Web Part will only be used by our Sandboxed Application Page.

    Then build your control logic in the Sandboxed Web Part.

    Add a Module item

    In the Web Part item add a new Module item. Rename the Sample.txt file to AdminPage.aspx or similar - just make sure the extension is .aspx. Your Solution Explorer should then look like the image to the right.

    Edit the URL and location in the elements.xml file if you want to deploy it in a document library or any other location. If you have named your items as shown above your page will end up at http://site/AdminPage/AdminPage.aspx.

    Edit the ASPX page

    Open up the the AdminPage.aspx and build a standard Web Part Page. You can copy the source from a basic Web Part Page using SharePoint Designer for instance. The source should look something like this when you cleaned it up:

    <%@ Page language="C#" 
    <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" 
      Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
    Sandboxed Admin Page
    <asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
    Sandboxed Admin Page
    <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
    <style type="text/css">
    body #s4-leftpanel {
    .s4-ca {
    <asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server">asp:Content>
    <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

    In this Web Part Page I have removed all unnecessary page directives and only kept the Page directive with the master page reference and the import of the Microsoft.Sharepoint.WebPartPages namespace, which we will soon use. In the PlaceHolderAdditionalPageHead some CSS is added to remove the Quick Launch and I added a page title and heading.

    Of course you can use any kind of HTML in here. You cannot use code-behind or inline server-side code though.

    Add the Web Part

    In the PlaceHolderMain the Web Part will be added. This is done by using the SPUserCodeWebPart, which is a wrapper for Web Parts that lives in the Sandbox. In my case it will look like this:

        ID="adminwp"     TypeFullName="Wictor.SBAppPage.AdminWebPart.AdminWebPart" >

    Here we need to edit two things. First the TypeFullName must be the full name of your Web Part, just check the .cs file of your Web Part if you don't know how to get it. Secondly we need to set the SolutionId attribute to the solution id value of our solution. You can get a hold of this id by opening up the Package Editor and select Manifest. Then check the Solution element for the SolutionId attribute and just copy it.


    The AssemblyFullName attribute contains a Visual Studio replaceable parameter which inserts the full name of your assembly.

    Deploy and enjoy!

    That's it - just deploy your solution and navigate to your custom sandboxed application page.

    Ready for action!

  • Dissecting the Office Web Apps cache in SharePoint 2010

    Tags: Microsoft Office, SharePoint 2010

    The Office Web Apps, OWA, in SharePoint 2010 is a great way to enhance the SharePoint experience. It allows users without a decent OS or a locally installed Office client to view and edit Word, Excel, PowerPoint and OneNote documents.

    When you install and correctly configures Office Web Apps (yea, can be a bit of a hazzle if you like me avoid the Farm Configuration wizard) and then enable the required Site Collections feature a cache will be created. This cache is used by Word and PowerPoint Web Apps to store the renditions (XAML) of the documents to speed up the process. Office Web Apps will create one cache per Web Application and the cache is stored in one of the Content Databases attached to the Web Application.

    The cache is actually a Site Collection, based on the Team Site template, which contains a Document Library called cache which holds the cached content.

    Office Web Apps Cache site

    The content in this document library is ZIP compressed files with the XAML and images of the actual renditions.

    Cached documents

    By default the cache is set to contain 100GB of caching per cache (i.e. per Web Application). You can configure the cache size using the Set-SPOfficeWebAppsCache PowerShell cmdlet. So 100 GB of data will end up in your content database if you use OWA quite frequently and this will also be a part of your backups!

    The Cache Site Collection

    What you should do is to move this Site Collection to a separate database! This database could have a separate backup schedule and SLA, since this is just a cache. It is better to have it in its own database instead of reducing the cache size. Of course the cache size depends on the usage most read or read/write using OWA. For instance if you have most read ops then you could easily increase the cache size and increase the retention times for the cache.

    So how do I move the cache then. Well, since it is just a simple Site Collection - just as we do normally to when site collections grow...

    1. Create a new database, call it for instance OWA_Cache
    2. Move the cache Site Collection to the new database
    3. Update your SLAs

    To move the cache Site Collection we can use some PowerShell love like this:

    $db = Get-SPContentDatabase | ?{$_.Name -eq "OWA_Cache"}
    $webapp = Get-SPWebApplication | ?{$_.Url -eq "http://sp2010/"}
    Get-SPOfficeWebAppsCache -WebApplication $webapp
        | Move-SPSite -DestinationDatabase $db

    Don't forget an IISRESET - the ultimate SharePoint command!

    Cache moved to separate Content DB

    Notice that I also specified maximum of 1 Site Collection to this content db. We do not want real Site Collections ending up there...

    Hmm...I'm turning this blog into an IT-pro blog....

  • SharePoint 2010 user profile properties temporarily disabled

    Tags: SharePoint 2010

    I am currently setting up SharePoint 2010 farms back and forth testing out the most optimal ways using least privileges and different configurations. The by far most complex part in the configuration is the User Profile Service Application and the User Profile Sync. Spencer Harbar have fortunately documented how to do it properly in his Rational Guide to implementing SharePoint Server 2010 User Profile Synchronization article. Following that you will likely not fail...

    Today I configured a new farm to thoroughly document all the involved steps from a clean OS to an optimal farm I followed Spencers instructions and after the mandatory boot (I always need the boot to get the FIM working) the UPS was up and running. I headed on over to the My Site to check that all properties was correctly imported and found this:

    Updating values in this field is disabled temporarily.

    Some of the user profile properties had this error. "There was a problem retrieving data for this field. Updating values in this field is disabled temporarily. You can still update values in other fields". I actually saw this error earlier today at a colleagues new farm.

    I was first tracing backwards what did I do wrong this time and found no errors so I headed on over to check how that property was defined in the service app. And now things really made me believe that I needed to start all over again.

    Office Location property!!! 

    This property really is misconfigured! I checked the miisclient.exe for mappings, examined logs inside out etc. I started up another farm I built the other day and in that farm the property looked fine and had no strange mapping. It's Friday and I don't have time for this - so I turned to the SharePoint Jedi Spence and without doubt he had the answer in his sleeve. The error is due to the fact that the Managed Metadata Service is not setup or configured.

    Since the UPS is the service I usually start with I had no other service apps running. I added the Managed Metadata Service and tada - the properties was working as they should. So if you stumble upon this you now know what to do and can leave Spence doing what he really should be doing Friday evenings...

    Thank you Spence!

  • Timer job changes and additions in SharePoint 2010

    Tags: SharePoint 2010

    Timer JobsTimer jobs is a great feature of SharePoint to use when you need to perform background execution at regular or specific times or when you need to execute code on all or selected servers in the farm. A timer job is a persistable object deriving from the SPJobDefinition class.

    SharePoint 2010 has updated this class in many ways, to the better. Not only can the timer jobs be configured and monitored better through Central Administration they can also be invoked on demand.

    SPJobDefinition changes

    The SPJobDefinition class in SharePoint 2010 has received some major updates. First of all the class now inherits from IBackupRestore which is an interface that tells that the timer job can be backed up. The IBackupRestore interface contains methods that you can override and implement to perform actions before and after restores and backups of the timer job. You need to override the EnableBackup property and return true if you would like to make a backup of the job.

    Another great addition is that all timer jobs now have a Progress value (ranging from 0 to 100) which you can set by calling the UpdateProgress(int) method. Awesome for long running timer jobs and the progress is shown in Central Administration.

    Long running job

    The new timer job method RunNow() creates a one-time-schedule and schedules it immediatley, if it is not disabled.

    There are lot of new timer job classes that all inherits from the SPJobDefinition. They are specifically made to target different types of artifacts of SharePoint. Some of the most interesting and valuable are:

    Pausable Timer Jobs

    You can now create pausable timer jobs. This is done by inheriting from the SPPausableJobDefinition and overriding Execute(SPJobState) instead of Execute(Guid). You can then use the current job state (SPJobState) to store values which are retrieved when the job is resumed.

    Running jobs on all content databases

    Another new timer job derivative type is the SPContentDatabaseJobDefinition.This is a timer job specifically made to perform actions on content databases. The timer job is distributed on the WFE servers and each content database is only processed by one job. Override the Execute(SPContentDatabase, SPJobState) to add your own processing. The job supports pausing.

    Running jobs on all Site Collections

    A really interesting new timer job type is the SPAllSitesJobDefinition. This one is derived from the SPContentDatabaseJobDefinition and has a method called ProcessSite(SPSite, SPJobState) which you override to process the SPSite object. This could be very useful to build site inventories/directories.

    Running job on a specific server

    The SPServerJobDefinition is a pausable timer job that is designed to be targeted to a specific server (SPServer).

    Running jobs for specific services

    The SPServiceJobDefinition is another pausable timer job that runs a job on all servers where a specific SPService has been provisioned. A very similar job is the SPFirstAvailableServiceJobDefinition which runs the job on the first available server which has a specific SPService installed. If you would like to run a job an all servers you can easily use SPServiceJobDefinition. Then use the timer job service (which is installed on all servers, except dedicated database servers) and pass SPFarm.Local.TimerService as the SPService parameter in the constructor.

    All of the new specific timer jobs are essentially smart derivatives of the SPJobDefinition but using these new abstract classes will certainly save you some time when you need to target your timer jobs.

About Wictor...

Wictor Wilén is the Nordic Digital Workplace Lead working at Avanade. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for seven consecutive years.

And a word from our sponsors...