Tuesday, August 21, 2007

SPFileCollection.Add ignores title property on upload

Using SPFileCollection.Add (String, Byte[], Hashtable) as described on MSDN I found that it's simply isn't working properly :-(

Adding system properties doesn't work:

dim oHash as new hashtable
oHash.add("Title","Leasing agreement with Smart Leasing Inc.")
oFile = oFolder.Files.Add(,,oHash)

oFile.Item("Title") is not equal to "Leasing agreement...".

The only way is to modify it manually after having added the file, e.g.
dim li as SPListItem
li = oFile.Item
li("Title")="Leasing agreement..."
li.UpdateOverwriteVersion(); ' In order to avoid creating a new version

Any explanations why "Title" property cannot be set in oHash would be appreciated.

Other problems with Add has been reported various places. This blog is worth reading.

Wednesday, August 08, 2007

SharePoint explorer view - cut-paste issues

Using SharePoint "explorer view" provides end-users with the old Windows Explorer view to files which is great.

However, in a few situations the "explorer view" behaves quite strange.

If you try using Cut-Paste the file is moved from one place to another - including all the history, old versions etc. This is great. However - the Cut-Paste does not respect event handlers that are operational.

I have an ItemDeleting events that blocks deleting documents from certain document libraries. It works fine from all interfaces (Word, SharePoint, Web Dav) - except from cut-paste. Obviously Microsoft had to implement custom code to handle the clipboard in this situation - and it seems that they forgot to respect the event handlers. Just too bad.

Any experience with similar issues much appreciated - as well as workarounds.