3

I'm trying to get a file from a network share during a SharePoint job execution. Funny thing is that this works flawlessly on my Dev machine and it works as well as a Console Application on Production, but I can't get any files during job execution on Prod using the same network path and account information.

This is the simple piece of code:

var filePath = @"Z:\";
var files = Directory.GetFiles(filePath, "?.gpg", SearchOption.TopDirectoryOnly);
if (files.Length == 0) return null

I'm on SharePoint 2010 so I cannot try anything else that .NET3.5. I'm going crazy. Any ideas? Thank you in advance.

Roberto Mauro
  • 55
  • 2
  • 9

1 Answers1

0

Use this,

    public DBStoreDocument(string filePath)
    {
        this.Load(filePath);
    }



string[] filePaths = Directory.GetFiles(@"" + directory, "*.gpg", SearchOption.AllDirectories);

foreach (string path in filePaths)
{
     Documenttest doc = new Documenttest(path);

}
Habib Adıbelli
  • 1,181
  • 7
  • 14