Microsoft.Office.Project.PWA.WSSEventReceivers.PSDBUpdater Unexpected end of file while parsing Name has occurred. Line 1, position 256

Just about every Project Server 2007 farm I have worked on has had this event log error. So, what exactly causes it? This is a flaw in SharePoint where it is not checking the whole encoded URL length that a document link will have before it is uploaded. The encoded URL Document link length combination of "http://server + directory path (all path folders) + document name" cannot exceed 259 characters by design. Internet Explorer 6 and earlier editions would not allow longer lengths (now Internet Explorer 7 and above allows longer lengths). At 260+ characters, you will see this event error:

Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: General
Event ID: 6875
Date: 5.2.2008
Time: 11:54:30
User: N/A
Error loading and running event receiver
Microsoft.Office.Project.PWA.WSSEventReceivers.PSDBUpdater in
Additional information is below.

: Unexpected end of file while parsing Name has occurred. Line 1,
position 256.

For example, the URL to a folder is " 1/directory 2/directory 3/directory 4/directory 5/" and lets say that the whole length of that URL is theoretically 240 characters long. A user then uploads a document to directory 5 with the name "My Document Name Is Too Long". This will result in a Document URL link that will be 278 characters long. SharePoint checks the Document name length (file and folder name lengths cannot be longer than 128 characters) and doesn't see a problem and allows the upload. Thereafter, the user clicks on the document link to open it and gets the dialog box below that tells the user the URL is too long and they should save with a shorter name - but allows the user to open the document. This is when the above error is recorded in the event log.

Of course the user doesn't shorten the name and SharePoint again allows the user to re-upload/save the document. To further compound this problem, SharePoint will take every space in a directory path or document name and encode it as %20. Now every space in your path is represented as 3 characters. For example: 8 spaces in your directory path and now you have 3 * 8 = 24 characters. You can see how this will cause a lot of errors. Unfortunately, SharePoint will allow users to keep creating deeper and deeper folder paths without checking for the resulting document URL link length.

OK, great Julian, you have told us what causes the error - how do I fix it?

First you are going to need to run a query I wrote against your Project Server site content database:

Check All Directory and Document Lengths
Convert All Spaces Into 3 Characters

			LEN(tp_DirName) AS Dir,
			LEN(tp_leafname) AS Doc,
			LEN(tp_DirName)- LEN(REPLACE(tp_DirName,' ','')) AS DirSpaces,
			LEN(tp_leafname)- LEN(REPLACE(tp_leafname,' ','')) AS DocSpaces,
			-- now lets add everything up together
			-- first we have all single spaces counted already in below line
			(LEN(tp_DirName) + len(tp_leafname) + 
			-- because a space in URL encoding is %20, which is 3 characters
			-- we have to multiply count of spaces by 2 and add to single space counted above 
			-- sharepoint uses URL encoding for all spaces in calculating total URL length 
			(LEN(tp_DirName)- LEN(REPLACE(tp_DirName,' ','')))*2 + 
			(LEN(tp_leafname)- LEN(REPLACE(tp_leafname,' ','')))*2)
		AS TOTAL -- total of all characters with each space now represented as 3 characters 
	FROM AllUserData
) Results

WHERE TOTAL > 240	-- why this number and not safe 259 limit (sharepoint errors at 260 URL length)? 
					-- because you have to account for the number of your prefix root site name characters 
					-- that will be in front of tp_DirName to make complete URL address
					-- in my case this was http://project2007/ which is 19 characters
					-- thus 259 - 19 = 240 
					-- be sure to replace the 240 number with whatever sum you come up with 
					-- =(259 - number of characters in your prefix root site name)
ORDER BY tp_dirname, TOTAL DESC 

Pay attention to line 27. You have to subtract out the number of characters your prefix root site name contains from 259 (see query notes). Now that you have the length results of all the URL's that will cause an error in the TOTAL column, you will have to figure out how to shorten the Directory path and/or the Document Name on the site to be equal to or be less than 259 HTML encoded characters. I always give the SharePoint/Project Manager a list of his/her problem URL's and ask them to shorten them so that they are aware of the changes. The moral of the story is to educate your users not to use a SharePoint site as a glorified LAN storage space. They should be using metadata and first level path document libraries to store and search their documents.

Permalink | Comments (0) | Post RSSRSS comment feed