Thanks!

Cascading Drop Down Sharepoint Foundation 2010

After the release of Sharepoint 2010, the request for Cascading Drop Down, filtered drop down, dependent drop down or what you call them is not so common anymore. The reason for this is of course the Managed Metadata Service, which is included in Sharepoint Server 2010.

There are still times, however, when you’d want to use the functionality below to filter your drop downs. If you for instance are running Sharepoint Foundation, not Server, you won’t have the Managed Metadata Service available at all. Or perhaps you are running server, but you want to use list data and not terms from the term store.

Read more about Cascading Drop Down in my previous post for Sharepoint 2007.

The solution
The solution below is tested with Sharepoint 2010, and is basically the same procedure as the one for 2007. The list is still standard Sharepoint, which gives great flexibility and stability. This way, the filtering is done in the forms for creating and editing elements. Because of this, you don’t even have access to the server to implement this.

1. Add the Jacascript
Download the Jquery file jquery-1.6.2.min.js by Jquery.com. Download jquery.SPServices-0.6.2.zip from the Jquery Library for Sharepoint Codeplex site (newer version is probably also OK). Upload jquery-1.6.2.min.js and jquery.SPServices-0.6.2.min.js (from the zip file) to a document library that everyone accessing your site has access to (a library on the top level site can be wise).

2. Create your relationship lists
Make two lists, one for the parent (Country) and one for the child (City):

Countries list:

Cities list:

The Country column can be a look up from the Countries list, but you can just as well use a standard single line of  text column, which I have done here. This can theoretically give better performance, but you must of course be precise when filling out the County column so that the values here matches the ones in the Countries list.

3. Create the list that is actually using the Drop Down

Vacation Plans list:

This is the list where I want my Cascading Drop Downs. Country and City are lookup columns against Countries and Cities lists. The lookups goes against the title field in the respective columns.

4. Make the magic happen
In Sharepoint Designer, create your own NewForm.aspx (or EditForm.aspx, you’ll need both if you want it to work when editing items). Editing forms is a lot easier now with Designer 2010.

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

insert this code:

<script language="javascript" type="text/javascript" src="/address to document library/jquery-1.6.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/address to document library/jquery.SPServices-0.0.6.min.js"></script>
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Cities",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "Country",
   childColumn: "City",
   debug: true
  });

 });
</script>

Save and create a new item using your new form:


Voila!

5.Explained:
relationshipList: “Cities” : this is the name of the relationship list = the list containing parent and child
relationshipListParentColumn: “Country” : Column name from the Cities list
relationshipListChildColumn: “Title” : Column name from the Cities list
parentColumn: “Country”: Column name from the list where the drop down is = Vacation Plans
childColumn: “City”: Column name from the list where the drop down is = Vacation Plans

You have lost of other options explained at the project site on Codeplex like sorting, multiple levels and so on.

Thanks to Marc D. Anderson for making this available.

I tested this on Sharepoint Server Enterprise 2010 with Service Pack 1 installed. It should work just as fine on Sharepoint Foundation. My installation is English Sharepoint with Norwegian Language Pack, but pure English should be jsut as fine.

KDC_ERR_S_PRINCIPAL_UNKNOWN

I got this error in the event log on a fresh Sharepoint Server 2010 February Cumulative Update installation:

A Kerberos Error Message was received:
 on logon session
 Client Time:
 Server Time: 17:6:26.0000 4/2/2011 Z
 Error Code: 0x7 KDC_ERR_S_PRINCIPAL_UNKNOWN
 Extended Error: 0xc0000035 KLIN(0)
 Client Realm:
 Client Name:
 Server Realm: DOMAIN.LOCAL
 Server Name: MSSQLSvc/sqlserver.domain.local:1433
 Target Name: MSSQLSvc/sqlserver.domain.local:1433@DOMAIN.LOCAL
 Error Text:
 File: 9
 Line: f09
 Error Data is in record data.

Solution:

Continue reading →

Review Samsung Wave II S8530

I have written a review of Samsung Wave II (S8530). This is a nice phone with an excellent screen, good flow in the menus and also some nice perks in the Bada menus. Unfortunately the data connection does not seem to be completely stable.

Otherwise, this is a great phone for not so much money.

Read the review (in Norwegian) in VG.

Read the complete review (in Norwegian) in Amobil.

Content Query Web Part – image on left with formatted date and description

There are tons of blog posts about using the Content Query Web Part to show for example news from an Announcement list. I myself learned a lot from this Heather Solomon post a couple of years ago.

In this post I am going to show you step by step how to create an Item Style for your CQWP that displays an announcements image, title, date and the first 250 characters of the description. This works for Sharepoint Server 2010, and unlike 2007 you don’t have to export the CQWP and change the code – no notepad this time!

 

1. For best practise, I created my own Content Type inheriting from the Announcement Content Type. Lets call this CompanyAnnoucement. To CompanyAnnoucement I added an existing site colum: Rollup Image. Add CompanyAnnoucement to the list(s) you want. If lots of people needs direction on this step, I’ll make a blog post about it.

Continue reading →

Updating Site Title (SPWeb web.Title) programmatically

Scenario:

Sharepoint 2010 (Server or Foundation) is installed, and you also have installed one or more language packs.

You update the SPWeb web.Title programmatically (web.Title = “New Title”, web.Update();) in C#, but the title is not updated in your browser. This will happen if your Sharepoint installation for example is English (1033), and your site is created in Norwegian (1044). It doesn’t matter if the installation language isn’t activated as a possible display language for your site, your updated title will only show when you choose the installation language as Display Language.

If you debug, you will se that the property web.Title is updated, but this is not what is shown in the browser. If you search further through the site’s properties when debugging, you will find a property called m_strTitle that holds your original title and obviously needs to beed updated. But, you cannot update this property directly.

So, how do you update the title in all Display Languages of the site?

SPUserResource resource = web.TitleResource;
foreach (CultureInfo culture in web.SupportedUICultures)
{
Thread.CurrentThread.CurrentUICulture = culture;
resource.Value = "New Site Title";
}

This also applies to for example web.Description, but not web.Name (which also is basis for the Site’s URL).

Remember to call web.Update, and ofcourse to do a web.Dispose if you are not using Using:)

Error installing Cumulative Updates

I was installing the latest Cumultative Updates (December 2010 version) on a small Sharepoint Server 2010 farm. I installed both the Foundation and Server hotfix package on the application server and then the web front end.

Next step was running the Sharepoint 2010 Products Configuration Wizard on the application server. The wizard started out just fine, but I only got to step 9 (“The farm is being upgraded in the timer service process. The task is 10.00% completed.”) where it subsequently failed (Configuration failed).  The error message was:

An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown.  Additional exception information: Failed to upgrade SharePoint Products.”

Reading in the logs revealed what seemed to be why the upgrade failed, but no hint on how to fix it:

01/04/2011 15:27:39  14  INF                    Resource id to be retrieved is UpgradeTaskFailConfigSyncDisplayLabel for language English (United States)
01/04/2011 15:27:39  14  INF                    Resource retrieved id UpgradeTaskFailConfigSyncDisplayLabel is Failed to upgrade SharePoint Products.
01/04/2011 15:27:39  14  INF                  Leaving function StringResourceManager.GetResourceString
01/04/2011 15:27:39  14  INF                  Entering function Common.BuildExceptionMessage
01/04/2011 15:27:39  14  INF                    Entering function StringResourceManager.GetResourceString
01/04/2011 15:27:39  14  INF                      Resource id to be retrieved is ExceptionInfo for language English (United States)
01/04/2011 15:27:39  14  INF                      Resource retrieved id ExceptionInfo is An exception of type {0} was thrown.  Additional exception information: {1}

When I ran the Configuration Wizard again on the application server, it succeded, but I suspected the upgrade was not completed. I subsequently ran the Wizard on the WFE also, where the upgrade succeded. In Central Administration, I now had one “Succeded” Upgrade Session on the WFE and one “Failed” Upgrade Session” for the application server on the Upgrade Status Page in Central Administration.

Restarting the servers or running the Configuration Wizard either via different psconfig variations or UI did not give me a successful upgrade session for the application server.

The next day I also got a warning in the Health Analyzer:

Product / patch installation or server upgrade required.
All required products must be installed on all servers in the farm, and all products should have the same patching and upgrade level across the farm.
Upgrade is required on server APPSERVER. Without the upgrade, the server is not in a supported state.

Obviously not a perfect situation. The solution which solved the problem and completed the upgrade was also mentioned. Here is the Powershell command that did the trick for me:

PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

Sharepoint 2010 December Cumulative Updates

The December 2010 Cumulative Updates for Sharepoint Foundation and Sharepoint Server 2010 has been released. They seem to contain quite a few fixes, especially for the User Profile Service which from what I read will synchronize faster (It might actually look like this is the case, I think User Profile Synchronization was somewhat faster now). For some reason they are not published on the official Sharepoint Update page, which is why I am writing this post.

I have installed the updates in a 2-server farm, everything seems to work fine afterwards.

Unlike after the October Updates, I didn’t have to re-provision the User Profile Synchronization Service afterwards, as this service was listed as started when I had finished upgrading. (If re-starting/re-provisioning this service, remember to add the Farm Account to Local Administrators and reboot before starting the service).

I have linked to the downloads on my download page.

Version number after updating should be 14.0.0.5130.

Update: The December 2010 Updates are as of 07.01.2011 now available via the Sharepoint 2010 Update Resource Center.

Review Nokia C3

I have written a review of Nokia C3. This is a cheap-cheap QWERTY-phone. The battery is great and the keyboard is OK, but the phone is too slow. S40 menus aren’t exactly state-of-the-art either. I’d rather buy the Nokia E5, which is almost as cheap and better to use.

Read the full review (in Norwegian) here.

Review HTC Desire Z

I have written a review of HTC Desire Z. The Desire Z is a feature-packed phone running Android 2.2 (Froyo), and also sports a QWERTY keyboard. In short Desire Z is almost all you can want from a phone, except the keyboard is not as good as it should have been, the sound quality is not great, and the Sense/Android interface is cluttered and unfortunately not so easy to navigate in for unexperienced users.

Read the full review at Amobil (in Norwegian) here.

Review HTC Trophy

I have written a review of HTC Trophy. Trophy is the first Windows Phone 7 from HTC. As other WP7-phones, the menus are simplistic but extremely responsive and easy to use. Compared to the Optimus 7 the Trophy is more compact and has better audio quality. The build quality and sound quality during music placback is however not as good.

HTC Trophy is another example that Microsoft got much right in the first version of WP7. For Norwegian users the main drawback is lack of support for downloading apps with a Norwegian Live-account.

Read the full review (in Norwegian) here.

Read the short version at VG (in Norwegian) here.