InfoPath Forms Services – There has been an error while loading the form error

October 18th, 2007 by mlotter

This week has been a pretty interesting week for me so far because I'm training a new guy on InfoPath 2007 and InfoPath Forms Services and we are getting new errors and I wanted to share one of them.  "There has been an error while loading the form" was an error that we got today when launching one of his forms.

After doing a little investigation we discovered it was a old form that he deployed and activated to a Site Collection through InfoPath Forms Services but then decided to remove it from InfoPath Forms Services before deactivating it from the Site Collection.  I was pretty amazed that he was able to successfully remove the form before deactivating all instances.  When I looked for the deployment files in the Features folder they weren't there so it appears it was removed successfully.  To resolve the problem we delete the form entry from the Form Template library on the main site and deleted it from the Site Content Type gallery.

Cheers

SharePoint Errors when you're SQL Server runs out of disk space

October 17th, 2007 by mlotter

Today started out pretty eventful because I got a couple emails from an existing client that was getting really strange errors from there SharePoint 2007 environment.  They were telling me that they were getting the following errors whenever they were trying to add new data to their SharePoint sites. 

Error – Unable to complete this operation.  Please contact your administrator ……

Error – Exception from HRESULT: 0×80040E14 … …

The errors that were sent to me did not really tell me anything but when they told me that they were unable to add, change or delete anything that was when I knew it had to deal with SQL being out of space or something like that.  After a little investigation I confirmed that the data drive was completely empty and the reason was because the SQL maintenance jobs.  The old SQL backups were not being deleted and after a period of time they ate up all the hard drive space (276 gigs).

Over the last several years I've seen this problem several times and most of the time it's because of miscommunication with the DBA group or just configuration of the SQL maintenance job. When I'm working with a customer we always sit down and create a database backup strategy for the SharePoint environment if they want or need help with it.  In my opinion this step is just as important as anything else.

Cheers

"Content Type is still in use" error when trying to delete an InfoPath Form from a Form Library

October 14th, 2007 by mlotter

When using InfoPath forms as Content Types you're bound to run into the error "Content Type is still in use", when trying to remove an existing InfoPath as a Content Type.

From my experience you will not be able to remove any InfoPath form Content Type from a Form Library that has submitted InfoPath forms based off that Content Type.  If the library is using multiple InfoPath form Content Types you can go into the Form Library Settings page and update a property for it not to show.  From the settings page locate the "Content Types" section and then click the "Change new button order and default content type" link.

From the "Change New Button Order and Default Content Type" page uncheck the "Visible" check box for he form you no longer want appearing on the Form Library "New" button.

If this InfoPath form is the only Content Type for the Form Library then you can go and edit the Form Library security and not allow any new forms to be added.  The Form Library security link "Permissions for this form library" is located on the Form Library Settings page under the "Permissions and Management" section.

Earlier this year, I also discovered that you can remove the "New" button from the Form Library toolbar by blanking out the library form "Template URL". This property is located on the "Advance settings" page and is only available when "Allow management of content types?" property is set to "No".  I'm not sure why you're allowed to do this but I thought I would share it because it was something interesting.

Cheers

 

South Carolina Code Camp great success

October 13th, 2007 by mlotter

As I posted earlier I was attending and speaking at the South Carolina Code Camp this weekend and I'm proud to say that the code camp was a great success, at least I thought so.  I was able to meet a bunch of new people and some old friends.  It was a great time.

On a personal note the 2 sessions that I did on InfoPath, InfoPath Forms Services and .NET went better than expected from the speaking standpoint but had technical problems with my VPC image and Vista but I was able to overcome the hurdles.  Having this opportunity to speak exceed all my expectations and hope to have another chance in the near future.  I would like to give Murray Gordon a special thank you for giving me this chance.

Cheers

InfoPath 2007 and InfoPath Forms Services error about user name cannot be verified

October 10th, 2007 by mlotter

Just last week an old existing SharePoint 2007 environment was re-introduced into the InfoPath development process for my current client and this morning when trying to preview a form either through InfoPath 2007 designer or InfoPath Form Services and using the InfoPath function "UserName()" the below error was given (error when viewing through InfoPath 2007).

The full error message is

InfoPath
Your user name cannot be verified because the form's security settings do not permit it.
Error occurred during a call to property or method 'get-UserName'.

The problem started to happen when the "Domain" textbox on the "Preview" screen and "Enter the URL of a server that is running InfoPath Forms Services and can be used to verify compatibility" textbox on the "Compatibility" screen from the "Form Options" menu was set to point to the development SharePoint server.  Below are visuals of the options that I'm talking about.

The error sort of took me back at first because there weren't any problems with any of the previous forms.  Since this was a new form I was thinking that there was a setting that was not correct but that wasn't the case.  While troubleshooting the issue I changed the form security to "Full Trust" from "Domain" and everything was working but I knew that wasn't the solution but it got me thinking in a different direction.  It got me thinking that it wasn't an InfoPath problem after all.  To further that theory I changed "Preview" and "Compatibility" values to point to production and when I previewed the form everything worked with no errors.  This confirmed my theory in my mind that it wasn't an InfoPath problem and I started to think what else is tied into InfoPath. 

So naturally I thought it could be an IE issue because we all know that IE is an integral part of InfoPath. The first thing that I did was open each SharePoint site that I was using in IE and looked at the security zone for each site.  To my surprise there was a difference between them.  The production site had "Local Intranet" and the development site had "Internet".  You can easily tell this by looking at the bottom right corner of the IE 7 browser.  After noticing this I added the development site to the "Local Intranet" zone and then tested my InfoPath form out again and there were no errors this time.

This error was a first for me since I started blogging everything on my experiences with InfoPath, InfoPath Forms Services and SharePoint for my current project.  I started to really think if I ran into this problem before and I'm thinking that it might have happened with InfoPath 2003 when building custom forms for a client or on an ASP.NET project but not a 100 percent sure.  I'm just really glad it wasn't a hard error to figure out.

Cheers

InfoPath 2007, InfoPath Form Services and Content Types

October 8th, 2007 by mlotter

After spending the last 6 months working with InfoPath 2007, "InfoPath Forms Services" and "Content Types" you start to understand lot of the different possibilities that are avaliable and I think it's pretty amazing on how versatile InfoPath 2007 forms are when used as Content Types in conjunction with InfoPath Forms Services.  In the old days which really aren't that old you only had one true way to publish an InfoPath form for viewing from SharePoint but know that has all changed with 2007 version.  Now you have 3 different ways of doing it if using SharePoint Enterprise and InfoPath designer.  You can still publish an InfoPath form directly to Form Library but now you can also publish a form as "Site Content Type" or "Administrator-approved form template" for uploading into "InfoPath Forms Services".  The third option is only available when the "Enable this form to be filled out by using a browser" is checked.  See image below for the actual details for each option.

The "InfoPath Forms Services" approach has pretty much become my favorite way because the SharePoint Administrator has control of which SharePoint Site Collection the form is activated in and the form is also gets installed as "Site Content Type" (Site Collection Feature).  By using this approach with the "Collaboration Portal" template it appears automatically in the central "Form Library" that is automatically created.  This gives everyone one central spot to access all the forms for that site. Clients that I've worked with think this is a dream come true because all forms can be stored and organized in one central location.

Now anybody that uses InfoPath all knows that most forms will need a place to reside once the form has been filled out and submitted for viewing the promoted form data or just viewing the submitted forms.  The above approach doesn't give this capability but just a way to launch the form.  When creating a new "Form Library" for an InfoPath form it can be done from InfoPath designer or specifying the form as a "Content Type" for a newly created library.  The first approach requires additional work from InfoPath and not to ideal from a support aspect because you would need to keep up with 2 instances of the form and this leaves a lot of room for potential problems.  If the form is added to the "Form Library" as a "Content Type" then there is no additional work besides selecting the form from the "Content Types" section on the form library settings page.

If the "Content Types" section doesn't appear then most likely the "Allow management of content types" is not set to yes.  This property can be found on the "Advanced settings" page and this link is available from the form library settings page.

You might be thinking how or when was the form published as a "Content Type" because you didn't specify it to be done because you only uploaded and activated it from "InfoPath Forms Services" in Central Administration.

When the form is activated with "InfoPath Forms Services" to the specified site collection it is automatically added as a "Content Type" (Site Collection Feature).  Now there are no worries about keeping the form in "InfoPath Forms Services" and form library in sync because it uses the same form.  While the form is specified in two different areas it will give the user the capability to launch it from either.

This approach might not be 100% ideal for all instances but it brings great flexibility that was missing.  For a future post I'll try to put together a series of screen shots on how to publish a InfoPath form to be uploaded into "InfoPath Forms Services" and also add it as a "Content Type" to a form library if there is a interest

Cheers

Speaking at South Carolina Code Camp on October 13th

October 2nd, 2007 by mlotter

The South Carolina Code Camp is coming up on Saturday, October 13th in Charleston and I'm happy to say that I will be doing a couple of presentations at code camp.  The presentations are titled "Pre-populating Active Directory User Information InfoPath 2007 and C# and create a workflow with SharePoint Designer for routing" and "Retrieving and submitting data with InfoPath 2007 and C#".  Both of these presentations will be based off work that I did for recent projects.  Information on attending the code camp can be found at http://www.sccodecamp.com/

I'm sort of nervous about speaking at this code camp because it will be my first public speaking engagement.  I've done a lot of informal class room type of training in the past and I'm hoping it will be a lot like that but I'm not 100% sure.  If anybody has any tips or examples on how to format Power Points for code camp presentations or anything else, I would greatly appreciate the advice or examples.

I'm really excited about this opportunity, attending this code camp and meeting some of the area InfoPath and SharePoint colleagues.  Hope to see you there.

Cheers

"SharePoint 2007: The Definitive Guide" book officially released

October 2nd, 2007 by mlotter

Earlier this year I mentioned that I wrote a chapter for a soon to be released book and I'm happy to say it was recently released.  This book is comprised of 11 different authors and covers a large range of topics on SharePoint 2007.

http://www.oreilly.com/catalog/9780596529581/

This is really exciting for me because it's my first book to be officially named on and I'm just happy it's finally published.  I would also like to thank everyone that helped me out on my one little chapter.

Cheers

InfoPath 2007 form corrupted and unable to preview, publish or open with InfoPath 2007 Designer

October 2nd, 2007 by mlotter

When designing forms with InfoPath 2003 or InfoPath 2007 there was always an instance that the form would get corrupted and it could no longer be viewed or published. Still today it's a big mystery for me on why it happens because I've never spent the time to research the problem because I'm usually able to fix it with small amount of extra work and below is how I do it. 

Normally I get an error message like

or

when trying to preview or publish a form. 

If the error occurs while the designer is still open then I usually close the designer without saving my changes if only minimal work has been done and then reopen it and the problem is gone.  If I've worked on the form for a long period of time then I save my changes and close the designer.  Then make a backup of the InfoPath form file and change the "xsn" extension to "cab".  Once it's changed to a "cab" file I open it and extract the contents into a folder and then open the "xsf" in notepad.  You don't have to open the "xsf" file in Notepad but it should be opened in a text editor.  If you try to open it by double clicking it then InfoPath tries to open it and the below error message will most likely appear.

Once the "xsf" file is open then search for the corrupted line or lines of code.  Once you find all the corrupted code remove it and save the file.  For my instance it was the following code that was corrupted.

<xsf:xmlToEdit name="FileAttachment_91" item="/my:AppChangeRequest/my:FormFields/my:Business/my:Attachment/my:FileAttachment" container="/my:AppChangeRequest/my:FormFields/my:Business/my:Attachment/my:?C?u?“?O?“?“?c">
                <xsf:editWith caption="FileAttachment" xd:autogeneration="template" component="xCollection">
                                <xsf:fragmentToInsert>
                                                <xsf:chooseFragment parent=".." innerFragment="my:FileAttachment">
                                                                <my:FileAttachment xsi:nil="true"></my:FileAttachment>
                                            </xsf:chooseFragment>
                                </xsf:fragmentToInsert>
                </xsf:editWith>
</xsf:xmlToEdit>

Then open the "xsf" by double clicking it and InfoPath will open the form successfully if no other errors are found.  At this point just save the form to recreate the "xsn" file and you are then set to start making new changes.  All the files that were extracted from the "cab" file and the "cab" can be safely deleted at this time because the new "xsn" file was created when the form was saved.

If the form was created as a Visual Studio project then all you need to do is close and save the "xsf" file and reopen the file with one of the available text editor choices.  These are available when the "xsf" file is right clicked on from Solution Explorer window.  Once the corrupted code is removed, save the file.  At this point re-open the file to make new changes the normal way.

If the form is saved and closed and then opened later then you might get this error.

If you get this error without the any of the details then finding the error might be a little hard unless the corruption is obvious while the code is reviewed with a text editor.  I've ran into this situation a couple of times and I've been lucky enough to find the corrupted code.  If you can't find the corrupted code then you will have to revert back to the last published version of the form.

As always if anybody else has any insight I would love to hear about it.

Cheers

Creating a Event Log and Event Log Source for InfoPath Forms .NET code

September 28th, 2007 by mlotter

Whenever working with a client that wants to build custom .NET code around there InfoPath forms I've always found it useful creating a new Event Log.  In most cases a new Event Source would also be created for each new form that's created.  Doing this gives the ability to easily identify what errors are occurring in the custom .NET code and which form is causing it.   The code written to accomplish this is pretty straight forward and was originally done several years ago.  The only drawback was it didn't read from a file to get its information but was hard coded in the code instead.  It wasn't a big deal for most clients because the developers were creating the forms and they just updated Event Log program during the process.  Several days ago there was a need to make the program usable for Administrators without the need of a recompile each time a new form was deployed.

With not having much time to think about it I decided to build a XML file as the source and have the console application load the xml file and bind it to a Class.  The addition of this extra functionality wasn't drastic and it actually only needed a new Class, three new additional lines of code and modification of some of the original code. 

By no means do I profess to be a .NET coding expert and I'm sure there is better ways of doing this but below is how it was done.

The code was written with Visual Studio 2005 and in VB.NET.  It was done this way because of the client requirements.  If somebody would like the example in C# please email me and I can post a C# version.

The code was built in a VB.NET Console application and the project was named "CreateEventLogSource" and the code file was also named "CreateEventLogSource".

The Class that was used for binding to XML was created as a XSD and then converted to .NET Class with the XSD.EXE tool.  Information on the XSD.EXE tool can be found at the following link. http://msdn2.microsoft.com/en-us/library/x6c1kb0s.aspx

While building the XSD file I also modified it manually set the properties "minOccurs" to "0" and "maxOccurs" to "unbounded" and this can be seen below.  You can also do this by using the properties window for the "EventLogSourceItem" Element in the second ComplexType box.

The XML file was based off the XSD and built in Visual Studio.  This was accomplished by copying the XSD to the "C:Program FilesMicrosoft Visual Studio 8XmlSchemas" directory.  Then adding a new XML file to the project and adding a new line with the property "xmlns=http://tempuri.org/EventLogSource.xsd" as seen below.  By doing this it gave me IntelliSense for building the rest of my xml document.  The http://tempuri.org/EventLogSource.xsd appeared in the drop down list once "xmlns=" was typed.

The code module for the project had the following "Imports"

and defined fields.

The code between the "Try Catch" statement was the following.

As you can see by reading the code the XML file is being added to a "StreamReader", "XmlSerializer" is being created based of the Class that was created from the XSD file and XML content is bound to the Class created from the XSD file. 

The Event Log object is then created and the data records are looped through with "For Each" statement.  Inside the "For Each" statement it first verifies if the entry already exist and if so it then reads the next record.  If it doesn't exist the necessary properties are set and event source and log is created. Then it writes a new entry to the log and writes a message to the console application screen verifying the completion.

Once it's done reading all the data it then writes to the console application screen with the last messages and pauses for a response.

The "Catch" and "Finally" sections are very straight forward and shown below.

As you can see it is pretty straight forward code and nothing fancy and last thing that I did to make even more user friendly was create a deployment project that creates a MSI for deploying the EXE and XML file.

As always any feedback is welcome on how to do something better or easier.

Cheers.