Just solved a problem, and wanted to document the solution.
Problem:
SharePoint MOSS 2007 Central Administrations site. Select Application Management --> InfoPath Forms Services --> Manage form templates.
This runs the page _admin/ManageFormTemplates.aspx
Response is the ever-helpful SharePoint screen: Error. Unknown Error.
Thanks, guys. How do I turn on custom errors in SharePoint?
And how do I get Manage form templates to work?
Disclaimer:
`No warrantees, express or implied, are granted with this information. Please note that this information is FREE and me being nice enough to give it to you does not mean that you should do anything with it, and that it won't do anything horrible to your systems. Above all, I'm not liable for what you choose to do with it.
As a matter of fact, THIS INFORMATION HAS THE CAPABILITY OF RUINING YOUR INFRASTRUCTURE AND COSTING YOU UNTOLD MAN-HOURS, MONEY, AND DOWNTIME. APPROACH WITH CAUTION.
Your continued reading is evidence of your acceptance of this risk, and your agreement that I have nothing to do with whatever problems you might have.
Solution:
To get useful errors in MOSS is not as easily as .NET, but the answer is out there. Here it is in an easier format.
Find the web.config for the site experiencing the issue (in this, case, the Central Administration site.)
If you're not sure where that is, IIS Manager --> <server> --> Web Sites --> Right-click <Web Site> --> Properties --> Home Directory tab --> Local Path. Copy and paste that string into the address bar of Windows Explorer.
Edit web.config in a text editor (preferably Notepad).
Set <SafeMode ... CallStack="false" ...> to CallStack="true".
Set <customErrors mode="On" /> to mode="Off". (This is the .NET way to turn on stack trace information.) If this is a production system, you should set customErrors mode="RemoteOnly" and troubleshoot from the web server console.
Set <compilation batch="false" debug="false"> to <compilation batch="true" debug="true">
Save your file. (Make sure the editor didn't add a .txt extension or something stupid.)
Now you'll get an error message that actually means something.
In my case, it returned the following error:
Object reference not set to an instance of an object. at Microsoft.Office.InfoPath.Server.Administration.FormTemplate.SolutionDeploymentFailed()
at Microsoft.Office.InfoPath.Server.Administration.FormTemplate.get_FormTemplateStatus()
at Microsoft.Office.InfoPath.Server.ApplicationPages.FormTemplatePropertiesPage.GetStatusString(FormTemplate template)
at Microsoft.Office.InfoPath.Server.ApplicationPages.ManageFormTemplatesPage.AddTemplateToTable(FormTemplate template, DataTable table, SPWeb web)
at Microsoft.Office.InfoPath.Server.ApplicationPages.ManageFormTemplatesPage.FillDataTable(DataTable table)
at Microsoft.Office.InfoPath.Server.ApplicationPages.GridViewPageBase.GridViewDataSourceView.FillDataTable(DataTable table, DataSourceSelectArguments selectArguments)
at Microsoft.Office.InfoPath.Server.ApplicationPages.GridViewPageBase.GridViewDataSourceView.Select(DataSourceSelectArguments selectArguments)
at Microsoft.SharePoint.WebControls.AdministrationDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at Microsoft.Office.InfoPath.Server.ApplicationPages.GridViewPageBase.RefreshDataGrid()
at Microsoft.Office.InfoPath.Server.ApplicationPages.ManageFormTemplatesPage.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Troubleshoot issues with Windows SharePoint Services.
I tried a bunch of things, but nothing worked. My partner (development-oriented) and I suspected that a database record in the list of published InfoPath forms had a null where it shouldn't be, but we couldn't figure out how to find the bad record. (Where does SharePoint store the darn thing?)
Well, he wrote up a script which uses imbedded SharePoint code (installed dll's) to get at the forms record, since we never could find the actual record in the database manually.
WARNING!!! This script is capable of deleting all of your installed InfoPath forms, as well as all associated workflows!! Do not run it unless you understand what each line is doing!
Private Function GetFSService() As FormsService
Dim Farm As SPFarm
Dim FS As New FormsService
Farm = SPFarm.Open("Data Source=<DataSource>;Initial Catalog=<SharePoint Config DB>;Integrated Security=True")
Try
FS = Farm.Servers.GetValue(Of FormsService)(FormsService.ServiceName)
For Each frm As FormTemplate In FS.FormTemplates
frm.FormTemplateStatus.ToString()
'for each St as Microsoft.SharePoint.SPSite in farm.
'frm.Delete()
'Next
Next
Catch ex As Exception
'ERROR
End Try
End Function
Ok, have you been warned enough? See that remarked little frm.delete? That tells the system to delete all your stuff. Bad. What my partner did was to unremark the delete command and run the script within VB Studio in debug mode, so he could step through it one line at a time. When it found the first record, he told it to delete the record, then checked the site again. Lucky for us, the record with the null field was the first one in the database. After that was deleted, everything was sunshine, lollipops, and roses again.
So there you go. I doubt you'll hit the same problem as I did; I didn't find any fellow victims on Google. But the methodology for turning off the custom error is darn useful. Thanks to Andrew Connell and Anders Rask.
-Tom Kretzmer