SBurden


Hi Folks,

I'm attempting to check to see if a file exists on our server before showing a link it.
I put this function in the Report Properties:
Code Block
Function isFile(PathFileName As String) As Boolean
Return isFile = System.IO.FileExists(PathFileName)
End Function

I chose a situation where I'm getting back two rows of data, one row is true and the other row is false however, when I run the report they're both coming back as 'True'.
We created a virtual directory to the file system that houses our files, so my PathFileName variable will contain something like http://Sales/North/Sales110907.pdf.
Can I use the FileExists in this fashion or am I going down the wrong path
I appreciate any help you can give.
Best regards,



Re: Check to see if file exist on server

BobP - BIM


I could be wrong, but I dont think you can use http in FileExists. It has to be a file system path. FileExists("\\salesserver\share\file.pdf")

BobP





Re: Check to see if file exist on server

SBurden

Hi BobP,

It works! Thank-you, Thank-you, Thank-you.

Best regards






Re: Check to see if file exist on server

SBurden

Hi Folks,

After getting this to work in BIDS, we moved to Report Server and it's not working. I added embedded code as per my prior threads. I'm not getting a error it just does not reflect the changes I made with BobP's help. Is there anything I have to do differently when I move the report to the Report Server with embedded code I appreciate any help you can give.

Best regards





Re: Check to see if file exist on server

SBurden

I found out this was a security issue.





Re: Check to see if file exist on server

suresh babu krishnappa

did u resolve this and if so how did u do it






Re: Check to see if file exist on server

SBurden

Hi Suresh,

If you read through this thread, BobP suggestion worked in BIDS and if you're looking to do something similiar look at the code I embedded. After getting that far and talking it over with my manager he told me not to use the File.Exist property because it will be a resource hog. So, I had to abandon that approach. I hope to resolve by changing the visibility of my link to the file based on a given condition. This is all new to me, and my manager told me its possible so I'm going to search it out. I hope that helps.

The link below is also a part.

http://forums.microsoft.com/MSDN/showpost.aspx postid=2386082&siteid=1

Best regards