Wednesday, May 28, 2014

Where is the file content when "HasStream" is "0"

In content database, all file metadata are stored in table "AllDocs". When a file is uploaded to a document library, the file content is stored in table "AllDocStreams". Well, many posts tell us that.

Recently I noticed that one file seems corrupted. In IE, it complains that "File not found". In SharePoint designer, it says:" Server error: The URL 'xxxxxxxx' is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current web."


I dig into it. In SQL table "[AllDocs]", the field "HasStream" of this file is "0". Of course, there is no relevant item in table "[AllDocStreams]".

There are other similar files with "0" value in "HasStream", but they work well.

Then, where is the missing file content?

In field "[AllDocs].[SetupPath]" of this file, the value is "Features\xxxx\xxxxxx.xsl". That reminded me that the missing file was used by a customized feature, and that feature was uninstalled a while ago.

So, this file was not uploaded manually, but been deployed with a feature! That explained everything.

To avoid this issue, we have two options.


  1. Don't deploy files into document library directly as part of feature.
  2. Delete the files when relevant features are uninstalled.

2 comments:

  1. Very informative post. I sometimes do presentations on SharePoint and was wondering if I could use your Print List example in my presentations and refer my audience to your website for further info.

    ReplyDelete