I am using the following code to reference a shell dll
Type t = Type.GetTypeFromProgID(\"Shell.Application\");
Shell s = (Shell)Acti
Instead of
Type t = Type.GetTypeFromProgID("Shell.Application");
dynamic shell = Activator.CreateInstance(t);
I used
var shell = (IShellDispatch4) new Shell();
shell.Namespace then works as expected.
Turns out that reference for a shell object defaults to IShellDispatch5, which can't be used in XP or 2003.
Ok,this is how I got through the problem incase it helps someone
This is how my new code looks like
Type t = Type.GetTypeFromProgID("Shell.Application");
dynamic shell = Activator.CreateInstance(t);
//This is browse through all the items in the folder
var objFolder = shell.NameSpace(@"\\fileshares\Files\test");
foreach (var item in objFolder.Items())
{
//This is to get the file's comments for each files in the folderitem
string file_version = objFolder.GetDetailsOf(item, 14).ToString();
Console.WriteLine(file_version);
}
This script is by combining help from http://nerdynotes.blogspot.com/2008/06/vbnet-shell32-code-compiled-on-vista.html
and
http://foro.h-sec.org/net/problemas-en-net/
The second link is in spanish,I used google translate to make it up in English
Thanks to all who replied to this question
Have a look at this: http://nerdynotes.blogspot.com/2008/06/vbnet-shell32-code-compiled-on-vista.html I think it's the same issue.