The end of an exciting era

Dear reader, due to the reason I’m still getting mails and questions I believe it is appropriate to announce, that this blog has been already retired for years. After 11 years being with Microsoft as a professional premier support engineer, I left the company in 2011 and my interests shifted slightly, away from coding. I still work in the IT & Architecture area, however .NET, Visual Studio & C# are not any more in my every day’s business focus. Strangely enough, I’m however missing badly the coding practice, so there are chances some day in the future I will return, but not yet. There are things going on recently, which I have to finish first.

Thanks anyway for your comments and encouraging statements. Whish you the very best in your professional career and personal life as well.

With best regards, sincerely your Stefan Repas

Posted in Uncategorized - Common | Leave a comment

FBA 2010 Utility Update

Saumil asked me whether in my previously posted FBA Utility for SharePoint 2010 the fixed page size (by default set to 5) could be made customizable. The answer is, yes, here it goes. Check out, the last menu’s Title has been changed to “Control Settings” (Picture 1). Clicking on that menu you will be able to switch caching on or off (like in previous version) and additionally alter the number of displayed users. The input (Picture 2) accepts a number between five and one hundred twenty. Why 120?  OK, this seems to be some truly arbitrary value, however I do not believe, you will feel comfortable managing as much as 120 users per page or more.

image

Picture 1 (The altered menu Control Settings)

image

Picture 2 (here you can set the page size from 5 to 120)

image

Picture 3 (Range validation in action)

Please note! You have to retract (uninstall) the previously deployed version and here you can download the new version. The V1.10 Package contains the old wsp as well.

image

http://cid-8d365142bc4869ab.office.live.com/self.aspx/.Documents/FBA%5E_Deployment%5E_V1.10.zip

Posted in SharePoint 2010 | 13 Comments

SharePoint Performance Tuning and Profiling

Introduction

There is a plenty of articles concerning this topic, so this article is not going to create another compilation of previously published approaches and methods, even at the end of this article you will find a list of some truly useful links. My contribution to the story is to make the community aware of a powerful gun while hunting performance bottlenecks. This gun is so amazingly effective and easy to use, yet I wonder the common awareness is less then expected.

The talk here is about the magical VSPerfASPNETCmd profiler command line utility, which is part of the Visual Studio 2010 Premium and Ultimate editions. It is truly strange, that opening the official Microsoft’s Command-Line Profiling Tools Reference, you will not find here VSPerfASPNETCmd mentioned, but you have to go rather to Command-Line Profiling of ASP.NET Web Applications.

It should be noted, that VSPerfASPNETCmd is not imperative for profiling, as this utility is rather a convenience tool. This means, you could do the very same profiling session and analysis using instead the classic set of profiling tools like VsPerfMon and/or VsPerfCmd.

First of all taming overheated expectations, let summarize the prerequisites this tool is appropriate to use in your scenario. If you are hunting performance bottlenecks caused by custom code located in your custom .NET Assembly loaded either from the GAC or from the bin-Directory, the VSPerfASPNETCmd  is your best friend. So it is important to underline, that profiling is only an option if previous analysis has identified the node and requests running your code as the suspicious part of the bottleneck-hunting story. In order to be more accurate let’s summarize shortly the methodology which would lead you to the idea to use the profiler:

  1. You have set up performance counters for long-running observation (Baseline, taking probes once a minute) and later you altered these counters for incident based short term observations (taking probes either once a second or every other second, or once in 5 second)
  2. You have set-up IIS log files especially the “time-taken” column is reported
  3. You have gathered ULS logs
  4. You have analyzed system & application event logs
  5. You have utilized xperf (Windows Performance Toolkit) from the latest Windows 7.1 SDK

About the the 1. – 4. exact howabouts you can read in this article Troubleshooting MOSS/WSS Performance Issues. Regarding 5. is the Quick Start Guide the best address to start with.

Let assume once more, that based on all these monitoring efforts you have lastly identified the requests and the node (e.g. the Web Front End Server) as the physical source of the bottleneck. More happily you even suspect a couple of custom Libraries as possible victims for further analysis. If you did so, there are these scenarios to consider.

Based on previous analysis:

  1. you can reproduce the issue in your test environment
  2. you can reproduce the issue in your production environment issuing appropriate requests
  3. you cannot reproduce the issue as it happens randomly

In cases 1. your destiny is to use VSPerfASPNETCmd. In case 2. you could utilize profiling in a limited manner. In case of 3. this utility cannot help you, as VSPerfASPNETCmd is not appropriate for long term observation. The amount of collected data should be limited to a time-span measured within a couple of minutes. Therefore in order to optimally utilize VSPerfASPNETCmd you have to prepare an exact step-by-step load/requests scenario which will reproduce the bottleneck with high probability.

In production environment special care has to be taken, as the profiler will restart IIS both at the beginning and at the end of the session. This is due to the fact, that profiler will inject additional libraries into the w3wp.exe process. Therefore this scenario of course is an option in a scalable farm environment while incoming requests could be routed through the remaining servers. Furthermore after the profiler is started and the IIS process runs, tester must make sure the issued test requests will be routed through the tested server.

Preparation

You have to install the Visual Studio 2010 stand alone profiling tools on the targeted server, which will deploy the .NET Framework 4.0. This could scare some people, however SharePoint 2010 will be not affected at all, and side-by-side installation of the .NET 3.5 SP1 and .NET 4.0 is supported by Microsoft. Here the installation guidance.

Additionally it is highly recommended, that you set up the _NT_SYMBOL_PATH environment variable. Here my preferred value setting, which will download and cache the symbols locally at c:\windows\symbols. Feel free to modify according your environment. More details in this regard you could find at Debugging Tools description.

srv*C:\Windows\Symbols*http://msdl.microsoft.com/download/symbols;cache*C:\Windows\Symbols

Sampling

Profiling means either sampling or instrumentation (or concurrency profiling which is not today’s article’s matter). There is often a confusion which one to use and when. In order to make decisions, it is important to understand the difference. Sampling is the “easy to immediately go” way. It does not need too much preparations except the scenario reproducing the appropriate load/pressure using any appropriate test-client. In the contrary while taking instrumentation, the observed libraries have to be instrumented, resigned and redeployed prior starting instrumentation. Thus this is the way to go if you want to provide more close and precisely targeted, fine-tuned observations.

Sampling could be started from any privileged command line window. If you suspect database related performance issues, make sure you will use the tier interaction option “/tip”. This will reveal the issued SQL-Statements during profiling.   

In order to do some example, I started profiling my previously published FBA Utility. First of all let’s take a look on sampling. Here the command line to start the session:

VSPerfASPNETCmd /tip http://trainingw2k8r2a:804/ /o:FBAsample1.vsp

The above command-line is targeting my web application listening on port 804. The output will be put into the FBAsample1.vsp file. Tier interaction data will be collected as well. Here you see the command line window as the profiler starts and shuts down. Note the red marker where the tests are running, the command line windows is blocked (Picture 1).

image

Picture 1

When you stop the profiler, it will download the symbols needed and will pack them into the produced output file. The best analyzer is thereafter Visual Studio 2010 itself. Just open the produced .vsp file and you can start immediately your own analysis.

image

Picture 2

The picture above (Picture 2) is the summary view, which is here divided in two parts. The first part in this particular case represents the IIS process being started (warm-up)and the second part at seconds 155 is the phase while running test requests against the up and running web application. In your scenario perhaps the second part will be longer. Using markers you can filter out this first part anyway, however this is an advanced scenario I will not talk about here and today.

Next you have to check the libraries being sampled using the modules view. This will allow you to see, whether the suspected libraries are captured.  In my case you see the FBAUserRoleManager.dll is listed with 161 samples collected. In your scenario this number could be even much higher (Picture 3).

image

Picture 3

Next you could check the Call Tree View and highlight the hot spots. In my particular case it is clearly visible the call depicted down to System.Web.Security.GetAllUsers() with exactly listed costs measured in samples. The more samples the more resources are used and consumed, the worse for the server (Picture 4).

image

Picture 4

Another interesting view is the Tier Interactions. As you can see, the UsersRoot.aspx page is accessing my aspnet database within my sqlexpress instance issuing 6 queries captured and the time elapsed for this calls. You see as well this very same page accessing the WSS_Content_804 content database as well, which is within a different (default) server instance (Picture 5).

image

Picture 5

Instrumentation

You have seen, that sampling will provide information mostly in numbers of captured samples, which is often enough to make conclusions. Sometimes however you need more details, like you would need to know the exact number of calls and the exact time spent within calls. In sampling we cannot answers these questions, except in tier interaction view. So how to do instrumentation?

First of all you have to instrument the libraries you will need to observe. For this reason switch in administrative command line windows to the location your (not yet instrumented) libraries live. In my case this is the debug folder beneath my Visual Studio Solution folder. Using the next command will list all available for instrumentation entries in the FBAUserRoleManager dll (Picture 6).

vsinstr /dumpfuncs FBAUserRoleManager.dll

image

Picture 6

Next you have to make sure you are using the 64 Bit version of the VsInstr tool. If you will instrument your dlls with the 32Bit version, your SharePoint process will crash (you have been warned!). Time to instrument the library using this command:

[%path to x64 folder%]vsinstr FBAUserRoleManager.dll

The library is now instrumented, meaning the instrumenter injected additional CLR code into the library. This however broke the signature and this library is not installable to the GAC. Therefore it has to be resigned using this command line:

sn -R FBAUserRoleManager.dll key.snk

The last parameter is the very same key-file from the Visual Studio Solution. Time to remove the originally deployed library from the GAC and re-deploying the instrumented and resigned library, using these command lines:

gacutil /u FBAUserRoleManager

gacutil /i FBAUserRoleManager.dll

Make sure the success message is displayed. Now we are prepared to run instrumentation profiling, which could be done similarly like sampling was started, although with one additional parameter “/trace”:

VSPerfASPNETCmd /trace /tip http://trainingw2k8r2a:804/ /o:FBAtrace1.vsp

The above command will start a new profiling session and your job is now to issue the same requests and doing so taking the server under pressure. The results are gathered in FBAtrace1.vsp file. Let’s assume I have provided the test and the end-file has been packaged with symbols and written to the disk. The most interesting part is perhaps in the Call Tree View. Here what I could observe (Picture 7):

image

Picture 7

This above Picture 7 is the instrumented view of the tests revealing exactly measured data. As you could see, the UsersRoot’s Page_Load() event handler was called exactly six times. These calls took exactly 1,127 milliseconds to execute. Going down to the bottom of the call, we arrive at Membership.GetAllUsers() which however was called only once and this call took 379 milliseconds to execute. The Tier Interactions view reveals (Picture 8), that UsersRoot.aspx issued 4 Queries taking 134.52 milliseconds to execute. So I could conclude that the call GetAllUsers() spent most of the time not in database call but rather more than 200 milliseconds somewhere else in the layers.

image

Picture 8

Of course, there are even more information saved in these profiling outputs to check and analyze. Try and enjoy.

Troubleshooting MOSS/WSS Performance Issues
http://blogs.msdn.com/b/mmcintyr/archive/2009/08/18/troubleshooting-moss-wss-performance-issues.aspx

Dealing with Memory Pressure problems in MOSS/WSS
http://blogs.technet.com/b/stefan_gossner/archive/2007/11/26/dealing-with-memory-pressure-problems-in-moss-wss.aspx

SharePoint 2010 Logging Improvements – Part 1
http://blogs.msdn.com/b/spses/archive/2009/12/18/sharepoint-2010-logging-improvements-part-1.aspx

SharePoint 2010 Logging Improvements – Part 2 (Introducing Developer Dashboard)
http://blogs.msdn.com/b/spses/archive/2010/03/11/sharepoint-2010-logging-improvements-part-2-introducing-developer-dashboard.aspx

SharePoint Server 2010 capacity management: Software boundaries and limits
http://technet.microsoft.com/en-us/library/cc262787.aspx

SharePoint Dispose Checker Tool
http://code.msdn.microsoft.com/SPDisposeCheck
http://blogs.msdn.com/b/rogerla/
http://blogs.msdn.com/b/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx

Patrick Heyde:
http://blogs.technet.com/b/patrick_heyde/archive/2010/04/21/sharepoint-performancetester-identify-your-bottlenecks.aspx
http://blogs.technet.com/b/patrick_heyde/archive/2010/05/08/sharepoint-performance-troubleshooting-part-2.aspx

On CAML performance:
http://blogs.technet.com/b/patrick_heyde/archive/2009/10/02/scalability-for-sharepoint-caml-query.aspx

HP SharePoint 200/2010 Sizer
http://h20338.www2.hp.com/activeanswers/Secure/548230-0-0-0-121.html

SharePoint Performance Tuning – Part 1, 2 (Caching & NTLM/Kerberos)
http://www.sharepointmonitor.com/2010/10/sharepoint-performance-tuning/
http://www.sharepointmonitor.com/2010/10/sharepoint-performance-tuning-part-2/

Overview of Kerberos authentication for Microsoft SharePoint 2010 Products
http://technet.microsoft.com/en-us/library/gg502594.aspx

How to avoid the Top 5 SharePoint Performance Mistakes
http://blog.dynatrace.com/2010/03/18/how-to-avoid-the-top-5-sharepoint-performance-mistakes/

Posted in SharePoint 2010 | Tagged , | 4 Comments

FBA Utility Source Code

I have promised to publish the complete solution with a few comments. First of all please note that upgrading the original Visual Studio 2008 solution (which was published on codeplex) to VS2010 will work, however note the obsolete project structure (Picture 1) you will experience after succeeded upgrade.  Picture 2 depicts the newly created solution which looks and feels more like an appropriate SharePoint 2010 project.

image
Picture 1 (Migrated)
image
Picture 2 (New Solution)

So the new solution consists of one Package, one Feature, one Custom-Action element and several Application Pages. The Feature targets a Web Site (SPWeb) as it did the previous solution. The Feature’s Event Receiver (Code 1) updates the site’s breadcrumb navigation map (Code 2) across the Server Farm submitting a new job. Note the commented out last line which would achieve the very same effect, however only locally. This means the alternative single line solution will work only in a single server scenario. The UpdateLayoutSitemap class was simply moved to this recent solution via copy & paste. Just check out if you wonder how such farm-wide job could be issued.

image

Code 1

image

Code 2 – layouts.sitemap.FBAUserRoleManager.xml

The CustomActionElement (Code 3) is intended to inject the new FBA Group (displaying the 48×48 security icon) and the two links into the Site Settings’ page (Picture 3).

image

Code 3 – Elements.xml

image

Picture 3

Completely new is the Utils.cs file holding the Utils class intended to deal with the Role, Membership and MembershipUser classes (System.Web.Security namespace) representing the key business logic pieces of this recent utility. These classes’ method-calls are routed through the SharePoint’s pre-configured membership provider as discussed in my previous article (SPClaimsAuthMembershipProvider). This utility class reads, writes, updates, deletes and caches users and roles as requested.

I have refreshed and reorganized almost every Application page and added a few new pages in order to support new functionality. I left out completely the option to switch between providers. The former utility’s author already noted, it does not make too much sense as one site collection will normally target only one claims based authentication provider.

Downloading the package you are accepting the Microsoft Shared Source Community License (SS-CL) Agreement.

http://cid-8d365142bc4869ab.office.live.com/self.aspx/.Documents/FBAUserRoleManager.zip

Posted in SharePoint 2010 | Leave a comment

Forms Based Authentication Utility for SharePoint 2010

A few people asked me whether there is a way to upgrade and adapt the well known utility published at http://fba.codeplex.com to recent SharePoint 2010. I did that task and here I’m publishing it as an example. The download is at the end of this article. I however started rather from the scratch with my Visual Studio 2010 solution. I made up my mind in this regard due to a couple of reasons. Firstly the upgraded original solution looked awfully in Visual Studio 2010. Secondly essential changes were required to accomplish this task, which I’m referring to below.

What is different in this solution package? The basic problem I was facing is that the Claims Based Membership Provider (SPClaimsAuthMembershipProvider class within Microsoft.SharePoint.dll) stopped supporting a couple of methods which worked in the earlier SharePoint 2007 version 12. Calling them  (GetUser, FindUserByName, FindUserByEmail) now will throw a not implemented method exception (Picture 1). This new restriction made a proper design somewhat challenging as there is no way to get exactly one user from the underlying membership database. Instead you have to load all users and filter them in the memory.

image

Picture 1 (Red Gate’s disassembler reveals the catch)

The former version of this provider loaded anyway all users each time you have asked for one particular.  Hence fore neither the old nor this new utility can deal with a large number of membership users. Due to the reason SharePoint 2010 is only 64 Bit, this looks like not a real obstacle while the number of users does not explode beyond several thousands.

Here the list of changes in this new version:

  1. Support for Security Question (RequiresQuestionAndAnswer property). The utility checks whether the underlying provider is configured to support this property and the concerned controls are grayed out or switched on appropriately.
  2. Supporting caching capability. This means the user can decide to use ASP.NET caching on the server which will lower database round-trips to the server (if SQL Provider).
  3. Supporting search for one particular user

 image

Picture 2 (Site Collection’s Site Settings)

image

Picture 3 (Manage Forms Based Authentication Users)

image

Picture 4 (Find particular user – no wildcard support yet)

image

Picture 5 (Edit User; note support for Security Question)

image

Picture 6 (New User)

image

Picture 7 (Breadcrumb navigation support)

image

Picture 8 (Managing Roles)

Deployment

Please note you have to adapt the deployment scripts to your current environment (the scripts are part of the download package). Simply uncomment the path to folder 14c if needed and insert your site-collection’s URL.

image 

Picture 9 (Installation script)

image

Picture 10 (Uninstallation script)

Here goes the Download to the zipped wsp solution package (the Visual Studio Solution Source Code will be published later on this web site – I’m going to add a few comments for developers). Downloading the package you are accepting the Microsoft Shared Source Community License (SS-CL) Agreement. Please note there is no support for this solution. I however appreciate your posted comments in this regard.

http://cid-8d365142bc4869ab.office.live.com/self.aspx/.Documents/FBA%5E_Deployment.zip

Posted in SharePoint 2010 | 32 Comments

Solution package containing the InfoPath 2010 repro

Introduction

In my last post I have been complaining about an InfoPath 2010 error while opening the form within internet explorer whereas it works fine while the very same form is running within InfoPath client application. I have asked questions about this indeed very strange behavior without really getting resolution. Of course I realized it is somewhat uncomfortable for anyone trying to help to buy the book and go through the steps in order to have the scenario I was talking about. Instead it would be better to create a solution package (wsp) and a deployment batch for anyone interested in this issue and deploy the scenario on her SharePoint 2010 server farm.

So I honestly confess you, that starting this my project I was unaware of those difficulties awaiting me and it took me some time to complete such solution package which I’m going to present here. The articles which helped me greatly to accomplish this task are at the end of this article along with the solution download link.

Please note this article deals only with the end result, meaning it describes only the wsp solution package and the repro scenario steps. I’m going to provide the complete Visual Studio 2010 solution along with the code in my next article, hopefully in the upcoming week.

Also note, that this article does not deal with the question, whether the recent InfoPath Form was designed properly and whether the very same Form could be designed using data Connection Libraries, relative paths and further approaches. This article only takes the Form from the declared book as is. 

Solution package described

So let me explain what this solution is about and which tasks have been resolved during development. The solution package will firstly create within a dedicated site collection two libraries (according to the books receipt they are named EventBudgets and NewEventForms). The solution will thereafter upload two Excel spreadsheets into the first library. These spreadsheets are later on used as data templates within the InfoPath form. The solution will thereafter rewire the second library’s default form template to our custom template form which is represented by the infamous InfoPath Form (Form2.xsn file).

Furthermore in order to accomplish the last task (rewiring with new content type), the InfoPath form has to be uploaded and published to the FormServerTemplates document library. The key was hence fore to figure the form’s customization methodology in order to reflect the current user’s environment and the current site collection. This form namely contains at least six Data Connections (Picture 1) all of those based on my SharePoint 2010 development server’s fully qualified domain name. I mean, imagine this form containing exactly thirteen times string artifacts like “http://mydomain/sites/chapter/<further characters>” whereas in your environment every Data Connection will not work correctly unless those string artifacts will exactly reflect your environment e.g. “http://yourintranet/blah/jonnykid/<further characters>”.

image

Picture 1

This above described (InfoPath Form) task was the core of the problem. I was forced to build upon this scenario:

  1. Put my XSN form into the WSP which is “contaminated” with my specific strings
  2. During solution deployment extract the XSN package (which is just a CAB file)
  3. Take from the extracted files those two files containing my private strings (which are the manifest.xsf and OpenWorkbook1.xml files)
  4. Load these XML files, parse and replace the strings and save the files
  5. Repackage the files and create a brand new XSN adopted to the target environment
  6. Take this XSN and upload and register it within SharePoint 2010 server

Further problem was to find some library dealing with cabinets, as no such exists within the official .NET Framework 3.5 SP1. So I took CabLib which is a very nice and very well documented, easy-to use signed library. The perfect choice to use within a SharePoint solution.

It was needed to figure, how to accomplish the timing around the form’s extraction and compression during feature deployment. Sahil Malik suggested in this article a particular declarative XsnFeatureReceiver-strategy, which indeed works fine, however it is impossible to use in my scenario as it would publish rather the original XSN Form. Why? This is due to the fact, that the form will be published immediately during wsp installation and there is no way to hook-in or repeat the step after succeeded XSN repackaging.

So I have decided to create my own Feature receiver class inherited from the XsnFeatureReceiver. This way I could during solution deployment uninstall the automatically published old XSN, alter that XSN, and republish it within FeatureInstalled. The tricky problem to be solved here was the fact, that within the Feature’s FeatureInstalled event handler there is absolutely no information yet available about the targeting site collection. This is only available within FeatureActivated event handlers’ context.  So I have resolved this catch using a somewhat unusual features-architecture like this (the name Chapter5 refers to the book’s chapter five):

  1. Chapter5_Feature2 is to be used to handle XSN uninstall and install
  2. Chapter5_Feature3 is to be used to handle feature activated events and repackage the XSN form (cabinet)
  3. Chapter5_Feature1 is to be used to create the two libraries and assign the appropriate custom content type to the second library

The deployment batch (Picture 2) reveals the timing (whereas %~1 is the targeting site collection):

stsadm -o addsolution -filename chapter5.wsp 
stsadm -o execadmsvcjobs
stsadm -o deploysolution -name chapter5.wsp -immediate -allowgacdeployment
stsadm -o execadmsvcjobs
stsadm -o uninstallfeature -filename Chapter5_Feature2\feature.xml -force
stsadm -o activatefeature -name Chapter5_Feature3 -url %~1
stsadm -o installfeature -filename Chapter5_Feature2\feature.xml -force
stsadm -o execadmsvcjobs
stsadm -o activatefeature -filename Chapter5_Feature2\feature.xml -url %~1
stsadm -o activatefeature -name Chapter5_Feature1 -url %~1
stsadm -o execadmsvcjobs

Picture 2

You see, the solution is added firstly to the farm, then it is deployed. During deployment the XsnFeatureReciever will publish the original XSN form which couldn’t be prevented and therefore the batch will next remove (uninstall) that feature. Thereafter Chapter5_Feature3 is activated providing the site-collection’s URL (see %~1). At this step the XSN package will be extracted, altered and compressed. Thereafter Chapter5_Feature2 is install in order to re-publish the repackaged XSN, and lastly Chapter5_Feature1 will do the rest of the job (described at the beginning above).

Step-by-step guidance repro scenario

How to use this package? Download please and unzip it in a dedicated folder. I have tested the solution deployment on several machines. As good starting point for appropriate machine environments I should mention firstly Sahil Malik’s SharePoint 2010 development machine created according to his book ‘s instructions. Another machine I have tested on is the official Microsoft Information Worker Demo Image which could be downloaded for free.

Here goes my step-by-step guidance for the test scenario. First of all please create a fresh new site collection based e.g. on the Team Site collaboration template, however this does not matter too much. Next open a privileged administrator command prompt, change the directory to the downloaded and extracted package’s directory (Picture 3) and run the DeployChapter5Xsn.cmd batch fed with your site collection’s URL (Picture 4).

image

Picture 3

image

Picture 4

The batch will show you twice the number of running deployments and hit enter if you are sure there are zero deployments running (Picture 5).

image

Picture 5

Please make sure the XSN form publishing succeeded. The success’s prerequisite is to see the Phase1 and Phase2 messages (Picture 6) immediately after feature re-install is kicked on.

image

Picture 6

After the batch completed switch to your site collection and make sure the EventBudgets and NewEventForms libraries are created and you see the links within the Quick Launch pane. The EventBudgets library should have two spreadsheets uploaded (Picture 7). The other library is empty yet.

image

Picture 7

Furthermore check the XSN form has been published and registered successfully going to you site’s Form Templates Library. In order to do so, click on the left hand side All Site Content >> Form Templates (Picture 8). You have to see Form2.xsn (Picture 9).

image

Picture 8

image

Picture 9

Select View Properties, and confirm you see the Form ID (Picture 10). If this piece of information is empty, then something went wrong. The Form has been uploaded however registration failed. Seeing the ID is reassuring.

image

Picture 10

Further check could be done in Central Administration >> General Application Settings >> Manage Form Templates. You should see here the Form2.xsn as well.

Now time is to test the Form, for which reason let’s go back to you site collection and click on the NewEventForms link. This will open that Library which is empty yet (Picture 11). Here you have to click the “Add document” link which should start the infamous form within browser (Picture 12).

image

Picture 11

image

Picture 12

My previous article deals with the question how to make sure this will truly start within browser. I can confirm if you are going to work with the Microsoft IW Image, this will immediately open in browser. Make sure the Event Type and Event Location drop down lists work fine. These lists are filled via RESTFul Data Connection reading the another library’s Lookups.xlsx spreadsheet. Fill your Event Name and click on the Submit button. This will bring you the reported error message (Picture 13).

image

Picture 13

So the demo’s first part succeed Smile as we have produced the error. In order to make sure the form is fine, let’s open it in InfoPath client. This could be only done if you have installed Office InfoPath 2010 on your system. The Microsoft IW Image fulfills this prerequisite as well. In order to force the form opening within client application, go to Site Actions >> Site Settings >> Site Collection Features  and activate the Open Documents in Client Applications by Default feature. Repeat now the previous steps and confirm the form is opened within InfoPath client (Picture 14)

image

Picture 14

Fill in your data and Submit the form. The InfoPath client will disappear. Go right now to your site collection’s NewEventForms library. You have to see the submitted document (Picture 15). Click on it! This confirms, the Form works fine, the document has been submitted as expected.

image

Picture 15

Conclusion: In this recent article I’m providing a download to a package which installs a repro scenario according the book’s (Pro SharePoint 2010 Solution Development: Combining .NET, SharePoint, and Office) scenario, whereas the InfoPath form works fine within client application however produces an error at submit while opened within browser. My question is whether anyone could take this solution and confirm the scenario behaves like described and perhaps could explain what’s going on. Thanks for your contribution. Here is the download to my package:

http://cid-8d365142bc4869ab.office.live.com/self.aspx/.Documents/Deploy.zip

Some useful articles concerning the topics above

Posted in SharePoint 2010 | 3 Comments

The workbook cannot be opened as it does not contain any visible named items

imageAfter 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).

image

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).

image

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.

image 

Picture 3

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).

image

Picture 4

image

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).

image

Picture 6

image

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.

image

Picture 8

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).

image

Picture 9

Also make sure the “Open Documents in Client Applications by Default” is NOT active (Picture 10).

image

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).

image

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).

image

Picture 12

image

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.

image

Picture 14

image

Picture 15

Posted in SharePoint 2010 | 2 Comments