čtvrtek 11. března 2010

System.IO.PathTooLongException while opening InfoPath forms in SharePoint

When opening a InfoPath form in SharePoint, you may get int he ULS log the following exception:

Unhandled exception when rendering form System.IO.PathTooLongException:
The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.

Some general info about the exception can be found here.

It is caused by the MSO-INFOPATHSOLUTION directive in the head of the xml definition of the form. The attribute HREF of this directive can not exceed the size of 260 characters.

Our InfoPath forms where designed as InfoPath 2003 forms, and the HREF attribute was really long:





but if you strip it down, you can see that a simple link to the file is enough.


href="http://intranet/teamwebs/informatics/Evidence%20poadavk%20WF/Forms/template.xsn"


The forms designed in InfoPath 2007 do not generate the href attribute that long. Also note if you just want the forms to open in the client application(InfoPath), you can set this on the advanced settings of the Document Library, in which the forms are contained. But even there, if there would be link to the file outside of this library, or if you will access the direct link, SharePoint will always try to open it in Web Browser.

This forum post had led me to the solution:
http://www.k2underground.com/forums/p/8709/26302.aspx#26302

pondělí 8. března 2010

WSS Tracing Service stoped - how to get the LOG info?

Sometimes in the SharePoint LOG, you can get the following information and nothing else:

Service lost trace events.

This happens when the Windows SharePoint Tracing Service is halted or not working. Usually you can just restart the service, but sometimes it won't work. The you can try to run TaskManager and end the process called "wsstracing.exe".

If that is not going to work you can restart the Internet Information Server or the whole Server.

But sometimes it is not possible - in the production department when you need the information of some actual error.

In this situation I use great tool called SPTraceView. This tool will attach itself as online listener to the SharePoint ULS and will capture the errors and messages for you. You can just run it and there is no need to restart the server or IIS.