All About Microsoft SharePoint

January 9, 2008

<link rel=File-List href=”[your file name]_files/filelist.xml”>

Filed under: Document library — calvin998 @ 12:47 pm
Tags:

This isn’t actually for SharePoint though.

When Microsoft Office saves file as HTML, it puts all real files under xxx_files. More on here: http://sharemypoint.wordpress.com/tag/_files/

When you try to rename/move/delete the root file, the associated _files folder will be changed accordingly. The key is in this line in the root file

<link rel=File-List href=”[your file name]_files/filelist.xml”>

If this line is removed, Windows Explorer will give you a warning only and won’t automatically move the _files folder.

This trick is useful for me when I need to rename the HTML root file. Otherwise, SharePoint will give you error message saying you can not rename the “thick” file (_file folder).

July 24, 2007

_files folder (part 3) Special delete rules for _files folder

Filed under: Document library — calvin998 @ 2:23 pm
Tags:
  • If there are sub-folders under this _files folder, you can’t simply just delete the _files folder. If you do so, you will get exception when you try to create same sub folder in same _files folder.

    • For a regular folder, you can always do this:
      1. web.Folders.Add(”Root folder”)
      2. web.Folders.Add(”Root folder/sub folder”)
      3. web.GetFolder(”Root folder”).Delete() // this will remove all folder content
      4. web.Folders.Add(”Root folder”)
      5. web.Folders.Add(”Root folder/sub folder”)
    • However for _files folder, step 5 will throw exception with message “Cannot create xxxx”. No further information available for the reason. You have to specifically delete all sub folders of it, then delete _files folder. Then you create _files folder, then sub folder.

_files folder (part 2) - “You cannot copy or move a thicket file” - how to rename

Filed under: Document library — calvin998 @ 12:34 pm
Tags:

Unlike in Windows explorer, if you delete/rename the htm file (even purge from Recycle Bin) in Sharaepoint, the supporting folder will NOT be renamed or deleted. If you try to rename the folder by calling MoveTo( string newFolderName ) method, you will receive this error message: “You cannot copy or move a thicket file. To change the file name or create a copy of the file, open the file and save as to a new name. The rule is that none of the previous folder name or new folder name can ended with ‘_fiels’ keyword. So, how do you rename such a folder to another name?

OK, how about to create the new _files by the new htm name, then move the files/subfolders over, then delete the old one? Well, you will receive the same error message. OK, then how about create another temp folder with a regular name and use it as a transit folder? A little better - the sub folders are OK but the files directly under it will still give you same error message.

Final workaround: create a local working folder and download the content, then create new folder at Sharepoint and re-upload everything, finally delete the old folder. This seems the only solution.

In my project, I came up with a better idea after wasting almost 2 days - I simply delete the old file and _files folder, and use another existing module to upload the new file.

_files folder (part 1) - what’s special about it

Filed under: Document library — calvin998 @ 12:25 pm
Tags:

If you create a folder in Sharepoint named like myfilename_files, this folder will be hidden on the UI. Many MS generated HTM files have this supporting folder.

(Note: you will not be able to create this kind of folder through Sharepoint UI, in which case an extra underscore will be appended to the folder name. You have to do it through API.)

If you do something like this:

SPFolder folder = web.GetFolder( “Shared Documents/myfilename_files”)

You will get folder.Exist is false. It seems that Sharepoint doesn’t want to reveal the existence of the folder. However you can delete the folder:

folder.Delete()

No exception will be thrown if the folder doesn’t exist, and sub folders and files will be deleted altogether. So do it carefully.

This screen dump of the properties of such a folder will help us to understand it better:

=======================web.GetFolder(”Shared Documents/myfile_files”)
{Shared Documents/myfile_files}
Audit: {Microsoft.SharePoint.SPAudit}
ContainingDocumentLibrary: {f0ba6962-57bd-42d1-b243-1a3ab63cb20f}
ContentTypeOrder: Count = 1
Exists: false <-note this
Files: {Microsoft.SharePoint.SPFileCollection}
Item: null
Name: “myfile_files”
ParentFolder: {Shared Documents}
ParentListId: {f0ba6962-57bd-42d1-b243-1a3ab63cb20f}
ParentWeb: {DMS(Demo Live Site)}
Properties: null <-note this
ServerRelativeUrl: “/Shared Documents/myfile_files”
SubFolders: {Microsoft.SharePoint.SPFolderCollection}
UniqueContentTypeOrder: ‘web.GetFolder(”Shared Documents/myfile_files”).UniqueContentTypeOrder’ threw an exception of type ‘System.NullReferenceException’ <-note this
UniqueId: ‘web.GetFolder(”Shared Documents/myfile_files”).UniqueId’ threw an exception of type ‘System.NullReferenceException’ <-note this
Url: “Shared Documents/myfile_files”
WelcomePage: ‘web.GetFolder(”Shared Documents/myfile_files”).WelcomePage’ threw an exception of type ‘System.NullReferenceException’ <-note this

=======================

This type of folder will not be listed under SPFolder.SubFolders collection.

Blog at WordPress.com.