After finishing Sahil Malik’s excellent SharePoint 2010 book (see series of previous posts) I’m going to consume another one and have decided to proceed with posting trouble resolutions. So my next candidate book is Pro SharePoint 2010 Solution Development (Combining .NET , SharePoint and Office 2010). Here in Chapter 5 you could face the error provided in the title above while doing these steps:
Download the suggested spreadsheet template from this source and rename it like suggested to Template.xlsx. Continue preparing that document via instructions on pages 69-70-71. If you upload now the Template.xlsx to the EventBudgets document library, after clicking on that document you could wonder getting this annoying error (Picture 1).
Prior to resolve the issues please note the EventBudgets document library should be created rather based on “Microsoft Excel spreadsheet”. In the book Figure 5-4 suggests taking Microsoft Word document” (Picture 2).
The question is, what to do in order to remedy the error (Picture1)? First of all you have to understand that the error is produced by Office Web Applications. When you save an Excel workbook to a SharePoint site, you can decide to save the complete workbook or to save only specific Named Items. If you save your Template.xlsx workbook to the file system, by default the Named Items option (can include sheets, named cells or ranges, tables, PivotTables, or charts) are not enabled as they are not needed in direct Excel interaction. However uploading the document to SharePoint you have to take care about Named Items in this way:
Open Template.xlsx in Excel and switch to backstage view. Click Save & Send >> Save to SharePoint >> Publish Options >> Show >> Sheets (Picture 3). Check the checkboxes meaning “Only the selected items are shown by Excel in the browser.” Save the document either to SharePoint or go back and click to save it to the file system. The document is ready to be uploaded to SharePoint and to be displayed within browser. That’s it, enjoy.
Another thing which is perhaps worth to mention. If you complete the Chapter 5 InfoPath form and will publish it into a freshly created new Forms Library named NewEventForms, you perhaps could wonder opening that library and finding it empty. The text tells you clearly “There are no items to show in this view“. So we succeeded to uploaded the InfoPath form to SharePoint yet no items are there (Picture 4). What the hell? The issue will be clearer clicking on the “Add document” link and voilà your uploaded form pops up (Picture 5).
The only problem to be resolved could be the unfortunate experience, that the form will perhaps not open in the web browser (like expected) and will rather trigger the InfoPath client application (Picture 5). So let’s examine this kind of puzzle (we are used to resolve rebuses while working with SharePoint. You see?).
First of all note that InfoPath Designer by default will try to create browser-compatible forms. This however could be not enough. Special attention is needed while publishing the form in InfoPath Designer and the publishing wizard will display an innocently looking message like depicted below (Picture 6). This message tells us “This form template is browser-compatible, but it cannot be browser-enabled on the selected site“. Clicking on that message you could get some more hints (Picture 7).
If you see these information popping up, just stop immediately the publishing as afterwards it could be quit difficult to remedy the forms not appearing in browser. Hence fore let’s go step-by-step like the dialog box (Picture 7) suggests.
The server is not running InfoPath Forms Service. You need SharePoint 2010 enterprise edition. See edition comparison here. If you run such edition go to Central Administration >> General Application Settings >> InfoPath Forms Services >> Configure InfoPath Forms Services >> User Browser-enabled Form Templates (Picture 8). Make sure the checkboxes here are checked.
The necessary features are not available on the site collection. In order to check switch to your InfoPath forms hosting site-collection. Go to Site Settings >> Site Collection Administration >> Site collection features and make sure the SharePoint Server Enterprise Site Collection features is active (Picture 9).
Also make sure the “Open Documents in Client Applications by Default” is NOT active (Picture 10).
The policy setting on the server does not allow users to browser-enable form templates. If you have set-up your development and test server manually, chances are high you have not set deliberately any additional policy preventing the users to see the forms in web-browser.
Let’s check one more place to make sure everything is fine. Open the form in InfoPath 2010 Designer and in the backstage view go Info >> Advanced Form Options >> Compatibility and make sure Web Browser Form is selected (Picture 11).
Let’s repeat the publishing steps to SharePoint using InfoPath 2010 Designer via backstage view >> Publish >> Share Point Server >> … If you see next the publishing wizard displays and offers the option “Enable this form to be filled out by using a browser” you have won (Picture 12). The form will be definitely available within web browser (Picture 13).
The unfortunate issue after we happily start using this form within web browser, that clicking on submit we could face another disastrous result (Picture 14). Looking for events via EventViewer there is a generic Event ID 5374 stating “There was a form postback error. (User: […], Form Name: NewEventForms, IP: , Request: […] Form ID: urn:schemas-microsoft-com:office:infopath:NewEventForms:-myXSD-2011-01-14T13-21-05, Type: KeyNotFoundException, Exception Message: The given key was not present in the dictionary.)”. Essentially this very same information is in the ULS as well. So here my science ends and appreciate your comments how to fix this InfoPath Form submission error. Please note within InfoPath Client everything works fine.