Archives

Archives / 2010 / July
  • SharePoint 2010 June 2010 Cumulative Update installation failed

    Tags: SharePoint 2010

    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

    Tags: SharePoint 2010

    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

    Tags: SharePoint 2010

    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

    Tags: SharePoint 2010

    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

AWS Tracker

About Wictor...

Wictor Wilén is a Director and SharePoint Architect working at Connecta AB. 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 four consecutive years.

And a word from our sponsors...

SharePoint 2010 Web Parts in Action