Home | Blog | Screencasts | Projects
# Wednesday, February 04, 2009

I came across an interesting problem today, the MySite link was incorrect, it was working the previous day.

The first step I took was to look at the SSP, which showed that the correct My Site location was entered.

The second step was to look at the Alternative Access Mappings, again they looked OK.

By now I suspected that the ISA server was doing something funny, we had asked the network guys to publish a new rule, so I had a look at the rule settings and found the culprit:

 

linktranslation

Notice the ‘Apply link translation to this rule’ checkbox, the ISA server was looking at the HTML returned by MOSS and changing the MySite entry, it’s actually a pretty cool feature of ISA that is handy if you are accessing your web application from the internet (to your intranet). But in my case it wasn’t needed and incorrectly setup.

I thought it was an interesting problem, by logically stepping through each potential cause and eliminating it, the root cause was discovered pretty quickly.

Wednesday, February 04, 2009 4:13:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
ISA | MOSS | Sharepoint
# Tuesday, February 03, 2009

A new whitepaper has been published on MSDN:

Analyzing SharePoint Usage

 

This whitepaper covers in detail the process of using LogParser to deeply analyse the logs produced by SharePoint.

Some of the topics covered include:

 

  • Using LogParser
  • Counting users
  • User type distribution
  • Requests (RPS) distribution over time
  • Distinct users over time
  • User agent distribution
  • Slow pages
  • Offlice web service usage

 

A lot of this information applies to any web application, not just SharePoint sites.

Tuesday, February 03, 2009 12:33:19 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [1] - Trackback
Sharepoint | WhitePaper

I came across a weird problem with IE and the way it automatically passes credentials to an intranet site. Basically we had an intranet site in the form of http://<intranet name>.<domian name>, e.g. http://intranet.httpcode.com.

Now if users set their homepage directly to this, they would be prompted to authenticate on the first page load, however if you first browsed to another site first (didn’t matter what it was, it could be google.com), then the intranet URL, IE would not prompt you to authenticate, it would work as expected. It’s as if IE didn’t know that the intranet site was in the Intranet zone on the first load.

I found this KB article, I’ve highlighted the interesting bit below:

http://support.microsoft.com/kb/258063

  • Internet Explorer must consider the requested URL to be on the intranet (local). If the computer name portion of the requested URL contains periods (such as http://www.microsoft.com and http://10.0.0.1), Internet Explorer assumes that the requested address exists on the Internet and does not pass any credentials automatically. Addresses without periods (such as http://webserver) are considered to be on the intranet (local); Internet Explorer passes credentials automatically

We ended up just creating the intranet site without a period, i.e. http://intranet this seems to work, in that IE on the first load passes the credentials on properly.

I’m not really sure what to say about this problem (if it is really a problem), I couldn’t find any relevant references on the web about it. Any ideas?

Tuesday, February 03, 2009 12:33:07 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [1] - Trackback
Tip
# Sunday, February 01, 2009

Recently I had to write a SQL Server Reporting Services Report that used a web service for the data source, the web service returned a horrible .NET DataSet object which I had no control over.

To use a web service from Reporting Services, the first step is to create a new Data Source of type: XML:

 

image

Then enter the URL to the web service in the connection string section.

The next step is to create a new DataSet for the report.

In the Query Designer enter the following:

 

<Query>
   <Method Name="<web service method name>" Namespace="<webservice namespace url>”>
   </Method>
   <ElementPath IgnoreNamespaces="True">
<web service method name>Response/<web service method name>Result/diffgram/NewDataSet/Table1   (replace Table1 with the dataset name if used)

    </ElementPath>

</Query>

 

If you need to pass parameters to the web service, this can be done by adding something like:

 

<Parameters>
       <Parameter Name="<parameter name>">
           <DefaultValue></DefaultValue>
       </Parameter>
   </Parameters>

But be sure that the case of the parameter name is exactly the same as the parameter in the report that you wish to pass in.

Sunday, February 01, 2009 9:05:00 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
code | Reporting Services | SQL 2008 | SQL Server
# Saturday, January 31, 2009

 

The following code will create a site based on a template, then it will add a new contributor group:

 

//create the subsite .. subSite is an SPWeb object
SPWeb createdWeb = subSite.Webs.Add("Url", "Title", "Project Subsite", 1033, "Template Name", true, false);

createdWeb.BreakRoleInheritance(true);

SPMember member = createdWeb.Users[createdWeb.Author.LoginName];
//create the user groups ...

createdWeb.SiteGroups.Add(createdWeb.Title + " Contributors", member, createdWeb.Author, "Contributors to the site");
SPGroup newContribGroup = createdWeb.SiteGroups[createdWeb.Title + " Contributors"];

SPRoleDefinition contribRole = createdWeb.RoleDefinitions.GetByType(SPRoleType.Contributor);
SPRoleAssignment contribRoleAssignment = new SPRoleAssignment(newContribGroup);
contribRoleAssignment.RoleDefinitionBindings.Add(contribRole);
createdWeb.RoleAssignments.Add(contribRoleAssignment);

 

The above code will break the permission inheritance, so the created site will have unique permissions, this code could be refactored to also create Owners and Reader’s groups.

Saturday, January 31, 2009 11:24:00 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
code | Sharepoint | Tip
# Sunday, January 25, 2009

I was playing around with setting up the navigation created by a legacy custom site definition. Information posted for my reference more than anything else:

 

<WebFeatures>
    <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
        <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
            <Property Key="InheritGlobalNavigation" Value="true"/>
            <Property Key="IncludeSubSites" Value="true"/>
            <Property Key="IncludePages" Value="false"/>
            <Property Key="InheritCurrentNavigation" Value="false"/>
        </Properties>
    </Feature> 
</WebFeatures>

 

Some of the settable properties are:

The boolean properties:

  • IncludeInGlobalNavigation
  • IncludeInCurrentNavigation
  • InheritGlobalNavigation
  • InheritCurrentNavigation
  • ShowSiblings
  • IncludeSubSites
  • IncludePages
  • SortAscending

The next properties take an enum:

  • OrderingMethod - Automatic, ManualWithAutomaticPageSorting, Manual
  • AutomaticSortingMathod - Title, CreatedDate, LastModifiedDate
Sunday, January 25, 2009 7:42:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
code | Sharepoint
# Friday, January 16, 2009

I’ve been working with a client recently that had a problem with the Web Front End servers randomly rebooting. The servers were Windows Server 2008 running virtually on VMWare ESX. Interestingly the problem didn’t occur on any of the other Win 2008 servers that also ran on VMWare.

Firstly we discovered that the machines weren’t just rebooting they were in fact blue screening and then rebooting after they did a dump.

So we fired up WinDbg and had a look at some of the dumps.

We found that the offending method was:

 

FAILURE_BUCKET_ID:  X64_0x7E_BAD_IP_HTTP!UlAuthenticate+73

 

The loaded module was HTTP.sys

 

This seemed to fit, the environment that was crashing was the only one to have Kerberos enabled, so we suspected some interaction between Kerberos and VMWare to be the cause (hence these were the only servers crashing). But since Windows 2008 runs HTTP.sys which is a kernel mode driver, we knew that as part of the Kerberos setup we had to explicitly allow the kernel to authenticate as the app pool user (via the application host file). We also knew that we could use IIS manager to move this authentication out to user mode, if you open IIS manager, expand the web site, select Authentication from the right and select the advanced properties on the Windows Authentication item. This will present you with the following option to ‘Enable Kernel-mode authentication’:

 

 

KernelModeAuth

 

After we deselected this option our servers have been running solidly.

Friday, January 16, 2009 12:18:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [4] - Trackback
Kerberos | Tip
# Friday, January 09, 2009

I received an interesting error today while trying to ‘Manage Data Sources’ on a report “The resource object with classname ‘ReportServer’ and the key ‘DataSourceList’ was not found”:

MOSSError

I found that sometimes it would work, but other times it would fail. A bit of tracing showed that when I hit web1 in the farm it would fail, but web2 would succeed.

With this information in hand I hand a look at the App_GlobalResources folder under c:\inetpub\wwwroot\wss\virtualdirectories\<web application name>

 

Interestingly web2 (which worked) had some resources called ReportServer.resx, but web1 (which failed) did not have these resources, that was what was causing the failures.

I copied the resources across and the issue resolved itself.

I suspect that the report services add on wasn’t installed properly.

Friday, January 09, 2009 3:53:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
Reporting Services | Tip
# Thursday, January 08, 2009

A little while ago I created a simple Application Definition for working with some CRM 4 data via the BDC.

Well recently the CRM Search Accelerator for Microsoft Dynamics CRM 4 have been released, which provides a better Application Definition File:

 

The enterprise search accelerator allows Microsoft Office SharePoint Server (MOSS) customers to view and search for Microsoft Dynamics CRM data directly from their SharePoint portals. By combining these two technologies users from different areas of the business will be able to:

  • View and edit any Microsoft Dynamics CRM data such as accounts, contacts, opportunities, sales orders, invoices, service cases and any custom entity data through MOSS.
  • Launch a MOSS search which can return documents, emails, web content and Microsoft Dynamics CRM data.
Thursday, January 08, 2009 10:51:00 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
CRM | MOSS

If your interested in seeing how Commerce Server and SharePoint can be integrated, you might want to take a look at the December 2008 CTP of Commerce Server 2009:

 

The bullet point of interest is:

 

  • Complete out-of-the-box e-commerce shopping site in SharePoint with new search functionality, new shopping features, and what-you-see-is-what-you-get (WYSIWYG) content management and design experiences. This helps to facilitate rapid assembly and maintenance of e-commerce Web sites by business users and creative professionals.

For more information about this upcoming release, the PDC session is a good place to start.

Thursday, January 08, 2009 10:12:00 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
Commerce Server | Sharepoint

A new web part for CRM 4 integration into SharePoint has been released by Microsoft:

 

Overview

The List Web Part for Microsoft Dynamics CRM 4.0 provides a way to view and update Microsoft Dynamics CRM records using a Windows SharePoint Services 3.0 SP1 or Microsoft Office SharePoint Server 2007 SP1 Web site. Microsoft Dynamics CRM users can create shared or personal List Web Parts of Microsoft Dynamics CRM records from a SharePoint Web site, open records in Microsoft Dynamics CRM 4.0 from the List Web Part, and create connected List Web Parts.

 

 

Ascentium has a blog post with some screen shots.

Thursday, January 08, 2009 9:39:00 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
CRM

I was working with a client recently who had the idea that they could make use of Excel Calculation Services to render parts of a spreadsheet that they use heavily inside their business. The client hoped to be able to publish the spreadsheet in it’s current form.

Unfortunately if any of the following features are inside your spreadsheet, it will fail to render:

 

  • Spreadsheets with code.  This includes spreadsheets with VBA macros, forms controls, toolbox controls, MS 5.0 Dialogs, and XLM Sheets.
  • IRM-protected spreadsheets
  • ActiveX Controls
  • Embedded SmartTags
  • PivotTables based on “multiple consolidation” ranges
  • External references (links to other spreadsheets)
  • Spreadsheets saved in formula view
  • XML expansion packs
  • XML Maps
  • Data validation
  • Query Tables, SharePoint Lists, Web Queries, and Text Queries
  • Spreadsheets that reference add-ins
  • Spreadsheets that use the RTD() function
  • Spreadsheet that use spreadsheet and sheet protection
  • Embedded pictures or clip art
  • Cell and Sheet background pictures
  • AutoShapes and WordArt
  • Ink Annotations 
  • Organization Charts and Diagrams.
  • DDE Links

 

In my case the complex spreadsheet that the client was using contained a number of these features, which basically meant that they need to maintain a cut down spreadsheet just for rendering on the intranet.

Thursday, January 08, 2009 9:34:00 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
Excel Services | Tip
# Tuesday, December 23, 2008

I’ve been working with a client this week getting Kerberos working on their SharePoint farm. As you would expect I spent most of my time working out what SPN’s needed to be created.

I created a simple little tool that will help you sort out the basic SPN’s:  SharePoint Kerberos SPN Creation Tool

 

image

The idea is that you enter the details about your farm and the tool will generate the SPN’s that you need to create (you can copy / paste from this site into your console window).

The client I was working with had a much more complex farm that included reporting services, analysis services and proxy servers that all needed SPN’s, this tool doesn’t cover those types of farms, but it will help you get the base portal services up and running, then you can work out what SPN’s to create in order to get the rest of the services functioning.

Don’t forget that you’ll also need to set up delegation for each of the accounts. By far the best SharePoint Kerberos reference is: http://blogs.msdn.com/martinkearn/archive/2007/04/23/configuring-kerberos-for-sharepoint-2007-part-1-base-configuration-for-sharepoint.aspx

Tuesday, December 23, 2008 9:47:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [1] - Trackback
Kerberos | Sharepoint | Tip
# Saturday, December 20, 2008

I’ve written a web part that can help you insert JavaScript into a SharePoint page. Currently there is nothing stopping you using a content editor web part, but it has a few limitations. First is the fact that the JavaScript doesn’t stand out, people may think that the content inside the editor is blank, when in fact it contains JavaScript.

By having a dedicated web part for JavaScript it becomes clearer that JavaScript lives on the page, also we can add a few features that make working with JavaScript a little easier.

 

image

I’ve made the chrome state set to None by default, so you won’t see the web part at all during normal render time (only design time).

 

The properties:

 

image

 

Page load JavaScript: This can be any JavaScript that you want to run when JQuery loads, that is any code you want to live inside of:

$(document).ready(function(){});

Something cool to try out (from EndUserSharePoint) try adding: $('#LeftNavigationAreaCell').toggle();  This will remove the left hand navigation.

 

Page level JavaScript: This is JavaScript that you just want to live on the page, it could be globally scoped variables or some functions that you have defined.

 

Script Includes: Each new line can be the URL to a JavaScript file to be included in the page, this is particularly useful for including JQuery plugins.

 

Use Google Libraries: Just a little novelty, it will use the Google Ajax API’s to load JQuery instead of the embedded JQuery resource.

 

You can have multiple web parts on the same page, the best bit about this is that all the code will be output into one place, so if you have one web part with some page load JavaScript that has say: alert(‘load’);  and anther that includes the left nav cell hide from above, the result in the page would be:

$(document).ready(function(){alert’load’); $('#LeftNavigationAreaCell').toggle();  });

 

After you deploy the solution, be sure to activate the feature under ‘site features’:

 

image

You can download the solution package from here.

Saturday, December 20, 2008 2:08:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [1] - Trackback
code | JQuery | Sharepoint

A while ago I wrote a little tag cloud web part,  I’ve updated that web part so that it has its own solution package and can be used stand alone.

 

After you install and deploy the solution, make sure you activate the tag cloud feature in ‘site features’

image

Lets take the example of adding tags to a standard events calendar.

 

First add a new column named ‘tags’ to the events list.

image

Add the tag cloud web part to the page and set the following properties:

image

 

You can specify the link that each tag will link to as well. By default it will link to the search center and try to search on the metadata property of the tag field. i.e: "/SearchCenter/Pages/Results.aspx?k={tagfield}:{tag}", using this format however you could link to any page and then maybe use a query string filter web part to pull the tag from the url.

image

 

The final web part looks like:

 

image

 

You can download the solution from here.

Saturday, December 20, 2008 12:13:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
code | Sharepoint
# Friday, December 19, 2008

This week I ran into an interesting problem. When adding a workflow to a content type we saw the following error:

 

Unable to validate data. at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)

 

I did the normal thing at searched on Google, only to find this KB (http://support.microsoft.com/kb/928028) which describes the error message, it gives the solution as ensuring that SharePoint is installed with the same path on each of the server. This seemed odd, since all our servers have a standard build.

The error message indicated that the view state has been modified between postbacks, so it was back to the drawing board looking for a solution that involved some change that could possibly have some effect on the view state. After talking with the designer it turned out that he had made some changes to the application.master page. We replaced the altered file with a backed up version of the application.master and sure enough the workflow could be added without any issues.

After a bit more experimentation it turned out that the problem was with this:

<SharePoint:DelegateControl ID="MyDelegateControl" runat="server" controlId="SmallSearchInputBox" />

It seems that the small search box alters the view state in some way to cause it not to validate on postback.

 

Hopefully this will save someone else the hassle of this error.

Friday, December 19, 2008 9:50:00 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
Sharepoint | Tip
Statistics
Total Posts: 191
This Year: 4
This Month: 0
This Week: 0
Comments: 41