How to get the full filename from ProjectItems?

400 views Asked by At

My code, which has been working right on another computer fails at FullPath and FileName points. The error is:

'object' does not contain a definition for 'FullPath' and no extension method 'FullPath' accepting a first argument of type 'object' could be found.

The code is :

var sftp = new Tamir.SharpSsh.Sftp(direction);
sftp.Connect();
foreach( var fileName in  sftp.GetFileList(Properties.Settings.Default.DirectorioFtp) )
{
    byte[] fichero;
    sftp.Get(fileName.FullPath, out fichero);

    var enc = new UTF7Encoding();
    string str = enc.GetString(fichero);

    ProcessFile(fileName.Filename, str);
}

I have loaded Tamir.SharpSSh succesfully, but I don't know if another library is needed or how to make filename of the necessary type.

1

There are 1 answers

0
Moshe Katz On BEST ANSWER

The source code for Tamir.SharpSSH.Sftp at http://sourceforge.net/p/sharpssh/svn/HEAD/tree/trunk/SharpSSH/Sftp.cs says that GetFileList returns an ArrayList of Strings (as Objects, because ArrayList is not a "generic" collection), and there is no FullPath property of String.

So there's no way that code could ever have worked with a non-modified version of the SharpSSH library. You need to check if the version on the other computer where this supposedly worked was a modified version.