Add to My Yahoo! | Google Reader or Homepage | Add to Windows Live | Add to Windows Live Alerts

Wictor Wilén

SharePoint Server MVP / Author / MCT / MCTS / MCP / MSc writing about SharePoint and other interesting Microsoft technologies

Latest postings

SharePoint 2010 June 2010 Cumulative Update installation failed

Posted at 2010-07-30 01:05 by Wictor Wilén in SharePoint 2010 with 1 comments.

PatchingI have been updating a couple of SharePoint 2010 servers and farms to the latest June 2010 Cumulative Update (CU) as well as installing a slipstreamed package. The slipstreamed install worked flawless using the same technique as with SharePoint 2007. But patching some of my servers seriously failed on both Windows Server 2008 R2 and Windows 7 with both SharePoint Foundation 2010 and SharePoint Server 2010. Here are some of my experiences of the patching.

Reboot required

Even though all June 2010 CU knowledge base articles says that a reboot is not required after applying the patches I indeed was required to boot after applying KB2028568 and KB983497 respectively. This doesn't bother me more than that it should have been told in the KB article. I don't know why I had to reboot and have not either tried to figure out why. It can have something to do with my configurations (even though I tried it on several different ones). Just reboot before running the SharePoint Configuration Wizard or psconfig and you will fine (almost - continue reading..).

Configuration Wizard fails

After rebooting the machines the troubles really started for me. I started the Configuration Wizard and it let me know that I needed to update so I went ahead. It starts going through the steps and on the final step where it usually takes some time it failed after a while. I opened up the PSCONFIG log files and found the following errors noted:

The exclusive inplace upgrader timer job failed.

Followed by:

An exception of type System.InvalidOperationException was thrown.  Additional exception information: Cannot open SPTimerV4 service on computer '.'.
System.InvalidOperationException: Cannot open SPTimerV4 service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)
   at System.ServiceProcess.ServiceController.Stop()
   at Microsoft.SharePoint.PostSetupConfiguration.ServiceHelper.Stop(String serviceName)

I can't say I hate error messages, contrary it gives me a challenge :-). Thankfully I had taken backups and even made snapshots just before updating the servers. The first thing I that came to my mind was that I was using a Farm administrators account to do this - but it was not the account that actually installed SharePoint 2010. As you know it is recommended to always have a separate account that you use for installation, patching and updating - and for nothing else. So I rolled back to where my snapshot was taken and used my install account instead - same error! Hmmm. Then I fired up another virtual machine - which also is a "least privilege" install of SharePoint and tried updating it - same error! Ok, now this is getting annoying! Tried updating SharePoint Foundation on my laptop - same error! @$$80!3 (censored)

After a lot of retries, Binging and chatting with some of the brightest. I run the Configuration Wizard again and even psconfig using the force argument (to see if I could see any difference). For one of the servers the Configuration Wizard actually completed. Yes! I went to Central Administration and unfortunately it reported that the server needed an upgrade. Back to square one! I also noticed the following in the PSCONFIG log file:

An exception of type System.InvalidOperationException was thrown.  Additional exception information: Cannot open SPTimerV4 service on computer '.'.
System.InvalidOperationException: Cannot open SPTimerV4 service on computer '.'. ---> System.ComponentModel.Win32Exception: Access is denied
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)
   at System.ServiceProcess.ServiceController.Stop()
   at Microsoft.SharePoint.PostSetupConfiguration.ServiceHelper.Stop(String serviceName)
   at Microsoft.SharePoint.PostSetupConfiguration.InitializeTask.StopServicesListedInRegistry(RegistryHelper registry, Boolean disableService)
   at Microsoft.SharePoint.PostSetupConfiguration.InitializeTask.StopAllServices()
   at Microsoft.SharePoint.PostSetupConfiguration.InitializeTask.Validate(Int32 nextExecutionOrder)
   at Microsoft.SharePoint.PostSetupConfiguration.TasksQueue.Validate(Boolean useDefaultExecutionOrder)

By the looks of the error messages this must have something to do with security. I verified that all accounts had the correct permissions, was correctly configured etc.

User Account Control is the culprit!

Finally I installed the CU on a server where I did not use a plethora of service accounts but instead used the domain admin to run SharePoint and that update worked like a charm. In Windows Server 2008 R2 the built-in Administrators account by default have User Account Control (UAC) disabled.

I went back to the other servers, disabled the UAC and repeated the update procedure using the installation account - and it worked flawlessly! Did the same procedure on another machine, and it worked there to.

Without to must investigation I assume that the account running the timer jobs is performing tasks that fires up the UAC. But since that is a non-interactive session you are not able to allow the operation.

So in order to get your CU (or other updates for that matter) for SharePoint 2010 to install correctly I recommend you to disable the User Account Control for you service accounts.

Anyone with similar experiences or comments to this?

How to provision SharePoint 2010 Rating columns in Content Types

Posted at 2010-07-28 06:43 by Wictor Wilén in SharePoint 2010 with 2 comments.

This post continues in the same neighborhood as yesterdays post about provisioning Managed Metadata columns. This time we take a look at the Ratings in lists (and while we're at it check out another earlier post about how to customize the look and feel of ratings).

The ratings allows anybody to rate items in lists and libraries in SharePoint 2010 Server. This is another highly usable and awesome feature tied to the Managed Metadata Service Application (MMS). To turn on ratings on a list you normally go to Library/List Settings > Rating Settings.

Rating Settings

When you enable this on a list or a library SharePoint adds two columns to your list called:

  • Rating (0-5)
  • Number of Ratings

But what do you do if you want to provision the rating with your Content Types and solution packages? It is quite simple - the only thing you have to do is to add the two rating columns to your content type.

How do I do it?

To create a content type with rating enabled create a new Empty SharePoint project in Visual Studio 2010 and add a new Content Type project item. Select a content type to derive your new content type from. Once the item is added then you will see the content type XML manifest. Add the following FieldRef elements which represents the rating site columns needed to enable rating.

<FieldRefs>
  <FieldRef ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" />
  <FieldRef ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" />
</FieldRefs>

Add a new item to the project of the type List Definition from Content Type and use your newly created content type. Also check the checkbox to create a list instance. Then deploy your solution (F5) to SharePoint and navigate to the new list that should have been created. If you create a new list item or upload a document you will see that the Rating has been enabled.

Ratings enabled for Content Type and list

You can also check the Rating Settings for the list or the library and verify that Ratings has been enabled.

Did you ever think that something could be that easy in SharePoint?

How to provision SharePoint 2010 Managed Metadata columns

Posted at 2010-07-27 03:57 by Wictor Wilén in SharePoint 2010 with 5 comments.

This post will show you how to provision Site Columns that uses Managed Metadata in SharePoint 2010. Managed Metadata is one of the new and exciting features of SharePoint Server 2010. It allows you to centrally manage metadata terms and keywords. Creating Managed Metadata columns using the SharePoint web interface is a simple task but the problem is that it does not allow you to move your Site Columns from one farm to another that easily. The reason is that these Site Columns definitions contains references to the unique IDs of the terms in the current Managed Metadata Service Application (MMS).

Exporting Site Columns

If you export a Managed Metadata Column and a Content Type using it to Visual Studio (SharePoint Designer > Export > Visual Studio Import, you know the drill) then you end up with definitions like below.

The Site Column is based on the TaxonomyFieldType and contains a Customization element which contains an array of properties (I've omitted most of them here). These properties contains IDs of the Managed Metadata group, term store and service application. Since these are unique for each MMS this definition cannot be provisioned to another farm (for instance from dev to stage, stage to prod etc).

<Field 
    Type="TaxonomyFieldType" 
    DisplayName="Custom (web)" 
    List="Lists/TaxonomyHiddenList" 
    WebId="~sitecollection" 
    ShowField="Term1033" 
    Required="FALSE" 
    EnforceUniqueValues="FALSE" 
    Group="_Custom" 
    ID="{fce6a8e2-23e8-49c2-9bad-a534555296bb}" 
    SourceID="{5e68c9eb-5efe-4bcc-b8db-93d38d797fbe}" 
    StaticName="__Custom" 
    Name="__Custom" 
    Overwrite="TRUE">
    <Default />
    <Customization>
        <ArrayOfProperty>
            <Property>
                <Name>SspId</Name>
                <Value 
                    xmlns:q1="http://www.w3.org/2001/XMLSchema" 
                    p4:type="q1:string" 
                    xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">b98dd270-8577-4db8-99e1-b9e894624fdb
                </Value>
            </Property>
            <Property>
                <Name>GroupId</Name>
            </Property>
            <Property>
                <Name>TermSetId</Name>
                <Value 
                    xmlns:q2="http://www.w3.org/2001/XMLSchema" 
                    p4:type="q2:string" 
                    xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">b7ae10cd-6c7c-4386-a1f2-7abec8e759e1
                </Value>
            </Property>
            <Property>
                <Name>AnchorId</Name>
                <Value 
                    xmlns:q3="http://www.w3.org/2001/XMLSchema" 
                    p4:type="q3:string" 
                    xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">00000000-0000-0000-0000-000000000000
                </Value>
            </Property>
            ...
        </ArrayOfProperty>
    </Customization>
</Field>
     

And if you examine the XML further you will also notice that a second field is defined for this Site Column. This field is of the type Note and is hidden.

<Field Type="Note" DisplayName="__Custom_0" StaticName="__CustomTaxHTField0" Name="__CustomTaxHTField0" 
    ID="{a6eae615-9835-4b75-97bf-d4e7a938b892}" ShowInViewForms="FALSE" Required="FALSE"     Hidden="TRUE" CanToggleHidden="TRUE" 
    SourceID="{5e68c9eb-5efe-4bcc-b8db-93d38d797fbe}" Overwrite="TRUE" />

A lot of XML but quite useless for reuse...

So how do I do then?

To provision the Site Columns and Content Types without these hardcoded Guids and IDs you basically have two options:

  1. Create an event receiver (or similar) that creates the Site Columns and Content Types programmatically
  2. A combination of declarative and the programmatic approach above

Solution ExplorerI prefer the second approach and I will show you how to do it (the first one can quite easily be done based on the code that will follow).

First you need to create a new SharePoint 2010 project in Visual Studio 2010, create a new Empty SharePoint project. Then add a new Content Type SharePoint Project Item (SPI) to the project and inherit it from the Item content type. Then add a new XML file to the SPI and name it Fields.xml. This elements manifest will contain the Site Column definition, but in order to make it into a manifest file you need to select the file and press F4 to edit the properties of the file. Change the Deplyment Type from NoDeployment to ElementManifest. Your solution should look like the image to the right. Also make sure to set the feature to be scoped to Site (Site Collection) level - we're talking about deploying Site Columns and Content Types here.

Then it is time to write the declarative part (i.e. the XML). You need to add a new Field element of the type TaxonomyFieldType (or TaxonomyFieldTypeMulti). Configure it as follows or as it suits your needs. Notice that I have set the ShowField attribute to Term1033, this is needed by the MMS to select the correct term value.

xml version="1.0" encoding="utf-8" ?> 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
  <Field ID="{749DA0D1-4649-4C25-871B-05F0C07221FC}" 
    Type="TaxonomyFieldType" 
    DisplayName="Home Country" 
    ShowField="Term1033" 
    Required="TRUE" 
    EnforceUniqueValues="FALSE" 
    Group="_Custom" 
    StaticName="HomeCountry" 
    Name="HomeCountry" 
     /> 
</Elements>

To add this field to the content type there is no rocket science, just do as you normally do:

<FieldRef ID="{749DA0D1-4649-4C25-871B-05F0C07221FC}" Name="HomeCountry"/>

That's all that you can do declarative. If this would be deployed a field would be created of the type Managed Metadata but you have to manually connect it to the MMS.

Now we have to dig into some programming to connect the field to the MMS. This is done in an Event Receiver for the feature. Right-click the feature and select Add Event Receiver. Uncomment the FeatureActivated method and implement it as follows:

public override void FeatureActivated(SPFeatureReceiverProperties properties) { 
    SPSite site = properties.Feature.Parent as SPSite; 
    Guid fieldId = new Guid("{749DA0D1-4649-4C25-871B-05F0C07221FC}"); 
    if (site.RootWeb.Fields.Contains(fieldId)) { 
        TaxonomySession session = new TaxonomySession(site);

        if (session.TermStores.Count != 0) { 
            var termStore = session.TermStores["Managed Metadata Service"]; 
            var group = termStore.Groups.GetByName("Wictors Group"); 
            var termSet = group.TermSets["Countries"];

            TaxonomyField field = site.RootWeb.Fields[fieldId] as TaxonomyField;

            // Connect to MMS 
            field.SspId = termSet.TermStore.Id; 
            field.TermSetId = termSet.Id; 
            field.TargetTemplate = string.Empty; 
            field.AnchorId = Guid.Empty; 
            field.Update(); 
        } 
    } 
}

MMS configurationThis method will first check if the field has been deployed. The field is retrieved using the Guid of the Field, defined in the XML. Once that is confirmed that the field exists a TaxonomySession object is acquired using the SPSite object. The TaxonomySession object is declared in the Microsoft.SharePoint.Taxonomy assembly - so you have to add a reference to that assembly first. To connect the field to the MMS you need to retrieve the Term Store, Group and Term Set. All this is done using the names of them as defined in the MMS. The image to the right shows how the MMS looks like that this code is connecting the field to. It is very likely that you have the same structure of the MMS in your different environments - if not you have to come up with a more configurable way :-)

Note the GetByName method used above is a custom extension that looks like this:

public static Group GetByName(this GroupCollection groupCollection, string name) { 
    if (String.IsNullOrEmpty(name)) { 
        throw new ArgumentException("Not a valid group name", "name"); 
    } 
    foreach (var group in groupCollection) { 
        if (group.Name == name) { 
            return group; 
        } 
    } 
    throw new ArgumentOutOfRangeException("name", name, "Could not find the group"); 
}

Once you have a hold on the taxonomy objects then it is time to convert the Field to a TaxonomyField object. This object is then configured with a set of properties. Specifically the ID of the Term Store and Term Set is set. Finally the field is updated to reflect the changes.

The Result!

That's it. All you now have to do is deploy it and test it out.

Final result

SharePoint 2010 June 2010 cumulative update

Posted at 2010-07-23 03:18 by Wictor Wilén in SharePoint 2010 with 2 comments.

The first cumulative update (CU) for SharePoint 2010 is here. The CU was promised in to be ready in June, but have not arrived until a couple of days ago. I've been on vacation (last day today actually) so it fits perfect starting out next week with patching some farms.

As you probably know by now the Microsoft SharePoint Team has improved the update cycle a bit compared to its predecessor. If you are not aware of the changes or need to get up to speed on the differences head on over to TechNet and read the following articles:

You can also always find the latest patch information for SharePoint at the TechNet Updates fro SharePoint 2010 Products page.

The June CU consist of the following KB articles and downloads:

  • SharePoint Foundation 2010 hotfix package (STS-x-none.msp), KB2028568
    Patch for SharePoint Foundation
  • SharePoint Server 2010 hotfix package (Osrchwfe-x-none.msp, Pplwfe-x-none.msp, Spswfe-x-none.msp), KB983497
    Patch for SharePoint Server
  • SharePoint Server 2010 hotfix package (Filterpack-x-none.msp), KB2124512
    Patch for SharePoint Server search filters
  • SharePoint Server 2010 hotfix package (osrchmui-ja-jp.msp, osrchmui-ko-kr.msp, osrchmui-zh-cn.msp, osrchmui-zh-tw.msp), KB2182938
    Japanese, Chinese and Korean SharePoint Server patch only
  • Search Server 2010 hotfix package (Word-x-none.msp), KB983319
    Search Server patch
  • SharePoint Server 2010 hotfix, KB2281364
    KB not live yet but you can request hotfix here.

In the Server package (KB983497) there are several fixes for the User Profile Service Application that you really need to install!

Prior to this CU Microsoft also released an update for SharePoint Foundation KB2032588. The following screenshot is from an SPF site before applying the June 2010 CU:

SNAGHTMLa495c48

After patching you should see that the new version number is 14.0000.5114.5003. Also notice how the update has been superseded by the CU.

SNAGHTMLa55ea54

SharePoint 2010 Web Parts in Action - 15 chapters

Posted at 2010-06-25 02:04 by Wictor Wilén in SharePoint 2010 , SharePoint 2010 Web Parts in Action with 0 comments.

wilen_cover150

After about six months of writing I have now written a total of 400 pages and 15 chapters about SharePoint 2010 Web Parts for my book called SharePoint 2010 Web Parts in Action. This is a book focusing on Web Part development in SharePoint 2010 and I think that it covers all that is needed for developers who wants to enhance their SharePoint 2010 and Web Parts development skills.

The chapters are:

  1. Introducing SharePoint 2010 Web Parts
  2. Using and configuring Web Parts in SharePoint 2010
  3. Building Web Parts with Visual Studio 2010
  4. Building the user interface
  5. Making Web Parts customizable
  6. Web Part resources and configuration
  7. Packaging, Deployment and Security
  8. Tools for troubleshooting and logging
  9. Caching for performance
  10. Dynamic interfaces in Web Parts
  11. Client Object Model and Silverlight Web Parts
  12. Making Web Parts Mobile
  13. Web Part design Patterns
  14. Connecting Web Parts
  15. Building Pages and Dashboards

I have submitted all my chapters to my publisher (Manning) and I am waiting for the final technical review of it before I can let it go (for this time). Once I have reviewed the reviews the book will be sent to typesetting and then it will be on the way to the printers. You will see the book in your closest book shop during this fall.

But, if you are interested you can actually grab the preview pieces of it right now. Manning has an Early-Access program (MEAP) that allows you to purchase the book right away as a preview e-Book and once the book is hot from the presses it will be sent to you. Head on over to http://www.manning.com/wilen to get your copy. Currently there are the first seven chapters available with two more on the way. If you do get it and you have feedback on it, contact me or discuss it at the Manning Sandbox forums.

While some really smart guys are doing the review, I'm shutting down for a while for a long awaited vacation. See you on the other side...

(written using the new Windows Live Writer beta...)

SharePoint 2010 Site Definition images must use the correct format

Posted at 2010-06-17 11:25 by Wictor Wilén in SharePoint 2010 with 1 comments.

When you create a Site Definition for SharePoint 2010 you should provide an image that illustrates the Site Definition. It allows the users to separate the Site Definitions from each other, find the correct one faster and it looks quite nice!

In SharePoint 2010 Silverlight is used when selecting Site Actions > New Site. This gives you a nice and fast interface to search for the correct Site Definition. The image of the Site Definition is here very prominent. SharePoint 2007 used a different interface but also used images to represent each Site Definition, but in another way and in another size, so might consider updating them if you are updating your farms.

Create a Site Definition in Visual Studio 2010

The Site Definition image is declared in the webtemp_XXX.xml file in the Configuration element using the ImageUrl attribute. When you create a new Blank Site Definition in Visual Studio 2010 your Configuration element will look like this:

<Configuration 
    ID="0" 
    Title="Default Site Def" 
    Hidden="FALSE" 
    ImageUrl="/_layouts/images/CPVW.gif" 
    Description="DefaultSiteDef" 
    DisplayCategory="SharePoint Customizations">
</Configuration>

Default Site Definition image Notice the ImageUrl property pointing to the default image. The problem here is that this little property actually has two problems:

  1. It uses a GIF image - which is not supported by the Create Site Silverlight app
  2. It uses an image of the wrong size

The image, shown to the right, has the size of 307x291 pixels and this size does not fit into the Silverlight application. And the image is of GIF format and that is not supported by the Create Site Silverlight implementation.

So what should I do?

Only PNG and JPEG images can be used, so you should create your own image and deploy to the mapped Images folder. Also set the size should be 64x64 pixels to fit into the Silverlight UI. The image below shows how it looks like with four different site definitions; the default image, a GIF image, a JPEG image and a PNG image.

Site Definitions

As you can see the GIF images are using a default image instead of the actual GIF image.

This is a small thing (compared to some other hefty stuff in SharePoint 2010) but for the end-user it really makes a difference and allows them to more easily select the appropriate template.

Enhancing the SharePoint 2010 Tag Profile Page with Bing news

Posted at 2010-06-14 02:51 by Wictor Wilén in Web Parts , SharePoint 2010 with 3 comments.

The Tag Profile Page in SharePoint 2010 is used by the Managed Metadata Service (MMS) as a landing page for a term or a keyword. It is used to describe the tag, its location in the taxonomy, synonyms etc. It also contains all the latest tagged items and a note board.

Tag Profile Page

The page is quite dull out of the box. Fortunately this page is a Web Part Page and can be customized as you like! Get Connected Web PartYou can add Web Parts and rearrange the page. There is not much you can do with the Tag Profile Web Part, but you can edit the Tagged Items Web Part and change how many days it should go back to look for tagged items (default 60 days). The Get Connected Web Part can be slightly configured with what links it will show, see image to the right. And the Noteboard Web Part also has some configuration options such as how many notes to show etc.

You could add some more out of the box Web Parts if you like but none of them integrates with the current term, not even through Web Part connections.

Wouldn't it be awesome to connect the tag to an outside service like...let's say Bing News, and see if there are any related news to the tag? Just like below? The image shows the standard RSS Web Part in SharePoint 2010 which is configured to query Bing News for the current term.

Tag Profile connected to Bing News

To achieve this I whipped together a small Provider Web Part that takes the term-id from the query string, looks up the value in the term store and then make that tag name available through an IWebPartField connection. This provider Web Part has one property which is used to set the name of the field. That field is then used by the RSS Web Part to create the query string to get the RSS feed. The provider Web Part is configured to be hidden on the page so that it is not seen by the users.

The code for the Web Part looks like this:

   1:  namespace Wictor.SocialExtensions.SocialTagInfoWebPart {
   2:      [ToolboxItemAttribute(false)]
   3:      public class SocialTagInfoWebPart : WebPart, IWebPartField {
   4:          string socialTagName;
   5:          Guid termId;
   6:          
   7:   
   8:          protected override void OnLoad(EventArgs e) {
   9:              try {
  10:                  termId = new Guid(this.Page.Request["termid"]);
  11:                   
  12:              }
  13:              catch (FormatException) {
  14:                  termId = Guid.Empty;
  15:              }
  16:              // get the tag name
  17:              TaxonomySession taxonomySession = new TaxonomySession(SPContext.Current.Site); 
  18:   
  19:              Term term = taxonomySession.GetTerm(termId);   
  20:              socialTagName = term.Name;
  21:   
  22:              base.OnLoad(e);
  23:          }
  24:          protected override void RenderContents(HtmlTextWriter writer) {
  25:              writer.Write(string.Format("id:{0}, tag:{1}",termId,socialTagName));
  26:              base.RenderContents(writer);
  27:          }
  28:   
  29:          [WebBrowsable(true)]
  30:          [Personalizable(PersonalizationScope.Shared)]
  31:          [WebDisplayName("Filter name")]
  32:          public string FilterName {
  33:              get;
  34:              set;
  35:          }
  36:          public void GetFieldValue(FieldCallback callback) {
  37:              callback.Invoke(this.socialTagName);
  38:          }
  39:   
  40:          public string TagName {
  41:              get {
  42:                  return socialTagName;
  43:              }
  44:          }
  45:   
  46:          public PropertyDescriptor Schema {
  47:              get {
  48:                  return TypeDescriptor.CreateProperty(this.GetType(), this.FilterName, typeof(string));
  49:              }
  50:          }
  51:          [ConnectionProvider("Social Tag name")]
  52:          public IWebPartField GetConnectionFieldProvider() {
  53:              return this;
  54:          }
  55:      }
  56:  }

This is a standard Web Part that exposes the IWebPartField interface (line 3) (which the RSS Web Part consumes). In the OnLoad (line 8) method the termid parameter is retrieved from the query string and this is used to lookup the name of the term using the TaxonomySession object (line 17) and stored in the local property socialTagName. The RenderContents (line 24) is used when in editing mode to display the status of the Web Part. The configurable property FilterName (line 32) is exposed so that the editor can change the name of the filter value that is sent to the consumer. For instance the Bing News RSS feed URL expects that the query parameter has the value "Query". The IWebPartField interface requires that the GetFieldValue and Schema methods are implemented. The GetFieldValue invokes the callback with the local property socialTagName and the Schema property returns a PropertyDescriptor of the type string and with the name equal to the FilterName property. Finally the provider connection end-point is configured.

Configure Connect The TagWhen the Web Part is deployed and feature activated on the My Site Site Collection you can edit the Tag Profile page and add the SocialTagInfoWebPart to the page. Configure it so that it is hidden and set the Filter name property to Query.

Then add the RSS Web Part to the page. Configure the Web Part, give it a meaningful name like Related on Bing and set the RSS Feed URL to "http://api.bing.com/rss.aspx?Source=News&Market=en-US&Version=2.0". This is the URL that will be used to query Bing News.

To connect the provider Web Part with the RSS Web Part edit the hidden provider Web Part and select Connections > Send Social Tag name To > Related on Bing. In the dialog box select Get Feed Parameter From and click Finish. Then save your page. When the connection is established the RSS Web Part will append the filter name and social tag name to the RSS Feed URL, for instance http://api.bing.com/rss.aspx?Source=News&Market=en-US&Version=2.0&Query=SharePoint

Connections

That is all needed to enlighten the Tag Profile Page. A little bit of coding can always sharpen up your SharePoint.

If you would like to connect it to other RSS sources, just edit the URL in the RSS Web Part and the Filter name in the provider Web Part.

Note: there are for sure other ways to do this and I bet the SharePoint "no-code" specialists will seconds after this post is available show you how to do it with a little bit of jQuery magic :)

Until next time...

Status of ChartPart for SharePoint 2010

Posted at 2010-06-08 12:37 by Wictor Wilén in SharePoint , Web Parts , CodePlex , SharePoint 2010 with 5 comments.

Chart Part

I have recently been getting quite a few requests and comments about the status of ChartPart for SharePoint - a charting Web Part that I built about a year ago and shared on Codeplex. This latest version have had more than 6.000 downloads which I think is amazing, version 1 had close to 10.000 downloads.

I temporarily put this project on hold a couple of months a go, due to two major reasons; the built-in Chart Web Part in SharePoint 2010 and that I'm currently writing a book (which essentially means that I have no time at all). Now we now that the out-of-the-box charting Web Part is SharePoint 2010 Server Enterprise only and I only have one and half chapters left on the book.

So I aim to produce a new and improved ChartPart for SharePoint 2010 as soon as I return from my (well deserved IMHO) vacation.

If you have any requests, ideas or rants about ChartPart for SharePoint then head on over to the Codeplex site and discuss or submit a feature request.

DevSum 2010 presentation about SharePoint 2010 BCS

Posted at 2010-06-02 09:55 by Wictor Wilén in SharePoint 2010 , Presentations with 2 comments.

DevSum 2010 is over two days packed with cool sessions. I had the last session of the day and conference but some brave SharePointers showed up and eagerly listened. I hope you enjoyed it and if you need some evening lecture you can download the presentation below, which was about SharePoint 2010 Composites and especially Business Component Services.

DevSum 2010

DevSum 2010 had some great content from local gurus and MVPs and the Microsoft Pattern & Practices group was here and shared some valuable knowledge! Thanks Cornerstone for arranging it!

SharePoint User Group Sweden May 2010 meeting recap

Posted at 2010-05-30 01:25 by Wictor Wilén in SharePoint , Presentations with 0 comments.

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

Posted at 2010-05-27 12:31 by Wictor Wilén in SharePoint 2010 with 0 comments.

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

Posted at 2010-05-25 01:42 by Wictor Wilén in SharePoint 2010 with 3 comments.

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

Posted at 2010-05-18 03:00 by Wictor Wilén in Web Parts , SharePoint 2010 with 4 comments.

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#" 
  MasterPageFile="~masterurl/default.master"  
  Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c"%>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" 
  Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
Sandboxed Admin Page
asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
Sandboxed Admin Page
asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<style type="text/css">
body #s4-leftpanel {
    display:none;
}
.s4-ca {
    margin-left:0px;
}
style>
asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server">asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

asp:Content>

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:

<WebPartPages:SPUserCodeWebPart 
    runat="server" 
    Description="Admin" 
    Title="Admin" 
    AssemblyFullName="$SharePoint.Project.AssemblyFullName$" 
    SolutionId="473f9e55-bf55-4283-a9ce-3de0b05650f7" 
    ID="adminwp" 
TypeFullName="Wictor.SBAppPage.AdminWebPart.AdminWebPart" > WebPartPages:SPUserCodeWebPart>

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.

SolutionId

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

Posted at 2010-05-08 07:14 by Wictor Wilén in Microsoft Office , SharePoint 2010 with 1 comments.

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

Posted at 2010-05-07 12:58 by Wictor Wilén in SharePoint 2010 with 4 comments.

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!

Real Time Web Analytics