1 Replies - 8598 Views - Last Post: 03 December 2009 - 06:24 AM Rate Topic: -----

#1 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Vbscript - run SSRS report & save report output, or create file in

Posted 02 December 2009 - 12:28 AM

Good day, I need help.



In vbscript i need to run a SSRS report & save output to a file.


http://biweb/Reportserver?http://...&rs:Command=Render&&rs:Format=PDF   



-- opens up in pdf

But i now need to automatically run the report & save the output as a file.


second choice, create a word file & insert values similar to a report & save file.


Please help - kind of in mess


Regards

Is This A Good Question/Topic? 0
  • +

Replies To: Vbscript - run SSRS report & save report output, or create file in

#2 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Re: Vbscript - run SSRS report & save report output, or create file in

Posted 03 December 2009 - 06:24 AM

Hi,

I got this so far from the net, it manages to output the file on the server but it does not run the url it just saves a damaged file.
I can run the url on the server (IE7) and save on server no problem.
I think the script is trying to create the file & not run the url then save as file.
 

Call HTTPDownload ("http://srv99-za178/departments/mkt/Factsheets/Buttermilk.pdf", "E:\upload.pdf") 

Sub HTTPDownload( myURL, myPath ) 

Dim i, objFile, objFSO, objHTTP, strFile, strMsg

Const ForReading = 1, ForWriting = 2, ForAppending = 8 

' Create a File System Object 

Set objFSO = CreateObject( "Scripting.FileSystemObject" ) 

' Check if the specified target file or folder exists,

 ' and build the fully qualified path of the target file 

If objFSO.FolderExists( myPath ) Then 

  strFile = objFSO.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )

 ElseIf objFSO.FolderExists( Left( myPath, InStrRev( myPath, "" ) - 1 ) ) Then 

strFile = myPath Else WScript.Echo "ERROR: Target folder not found." 

Exit Sub 

End If

 ' Create or open the target file 

Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True )

 ' Create an HTTP object 

Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )

 ' Download the specified URL 

objHTTP.Open "GET", myURL, False 

objHTTP.Send

 ' Write the downloaded byte stream to the target file 

For i = 1 To LenB( objHTTP.ResponseBody ) 

objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) ) 

Next

 ' Close the target file 

objFile.Close( ) 

End Sub 


I open the file it creates in notepad
 e not authorized to view this page</h1> 
You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept. 
<hr> 
<p>Please try the following:</p> 
<ul> 
<li>Contact the Web site administrator if you believe you should be able to view this directory or page.</li> 
<li>Click the <a href="java script:location.reload()">Refresh</a> button to try again with different credentials.</li> 
</ul> 
<h2>HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration.<br>Internet Information Services (IIS)</h2> 
<hr> 
<p>Technical Information (for support personnel)</p> 
<ul> 
<li>Go to <a href="Microsoft">http://go.microsoft.com/fwlink/?linkid=8180">Microsoft Product Support Services</a> and perform a title search for the words <b>HTTP</b> and <b>401</b>.</li> 
<li>Open <b>IIS Help</b>, which is accessible in IIS Manager (inetmgr), 
 and search for topics titled <b>About Security</b>, <b>Authentication</b>, and <b>About Custom Error Messages</b>.</li> 


I don't understand i have rights!
Please provide code as i got off the net & don't know what to do :(
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1