Sidebar Gadget docs broken?

Today I've just lost 30 mins trying to enumerate the items that exist inside a folder with the Gadget API. Guess what? The docs aren't correct (I'm not sure why, since Gadgets exist for a long time now). Several things I've found today:

  • I couldn't manage to get the System.Shell.Folder.parse method to work;
  • There isn't an Items property on a System.Shell.Folder object
  • The same thing goes for the methods of that class (at least, copyHere and moveHere - I tried these)

Solutions: for the parse method,  I've manage to use the System.Shell.itemFromPath to get a reference to a folder object (I'm still not sure on why the parse method didn't work with me - I'm probably doing something wrong). If you need to get the items that exist inside a folder, you must use the SHFolder property (which the docs don't mention) and only then you'll get references to those elements. Here's a quick example of how you can use this info (the sample shows how to copy items from one folder to another):

var currentFolder = System.Shell.itemFromPath( "some path here" );
var folder = System.Shell.itemFromPath( "some path here" );
for( var i = 0; i < folder.SHFolder.Items.count; i++ ){
   var item = folder.SHFolder.Items.item(i);
   currentFolder.SHFolder.copyHere( item, 16 + 256 + 512 );
}

btw, I've just opened a new thread on the gadget forums. If you know the answer, please add it to the comments or as reply to that thread.

Filed under:

Comments

# arenda kvartir peterburg bystro said:

energosnabzhenie kvartiry blagoveschensk arenda kvartir 2 aya kvartira kupit kvartiru predlozheniya <a href="betaflat.com/">arenda kvartir peterburg bystro</a> kuplyu 1komnatnuyu kvartiru oformit pokupka kvartir ekaterinburg sdat kvartiru marksistskaya rynok kvartir sankt peterburg

Friday, December 14, 2007 8:29 PM
# nedvizhimost sdayu tomsk said:

nedvizhimost sdayu tomsk nedvizhimost sdayu tomsk <a href="omegaflat.com/">nedvizhimost sdayu tomsk</a> nedvizhimost sdayu tomsk nedvizhimost sdayu tomsk nedvizhimost sdayu tomsk

Sunday, December 16, 2007 10:00 AM

Leave a Comment

(required) 
(required) 
(optional)
(required)