Forum Discussion
The links and two functions that might inspire you:
http://stackoverflow.com/questions/3787870/vbscript-to-upload-file-to-sharepoint-doclib
http://smartbear.com/forums/forum/post/?mode=singleThread&thread=c7afffa0-8fa9-4bf4-97dd-4a604c72fd1b
http://automated-testing.info/knowledgebase/article/integracija-ruby-i-testcomplete
http://sharepointfieldnotes.blogspot.com/2009/09/uploading-content-into-sharepoint-let.html
http://www.codeproject.com/KB/sharepoint/SharePoint.aspx
//------------------------------------------------------------------------------
function CreateExpectedBin(strResultFileName : string; input : string {byte[]})
: boolean;
var oFileStream : OleVariant;
var oBinaryWriter : OleVariant;
begin
Indicator.PushText('Writing ' + strResultFileName + ' file');
oFileStream := dotNET.System_IO.FileStream.zctor(strResultFileName, dotNET.Sys
tem_IO.FileMode.Create);
oBinaryWriter := dotNET.System_IO.BinaryWriter.zctor(oFileStream);
try
oBinaryWriter.Write_3(dotNET.System.Convert.FromBase64String(input));
finally
oBinaryWriter.Close();
oFileStream.Close();
Indicator.PopText();
end;
end;
//------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
' download a file sending an HTTP request by using the XMLHTTP ActiveX object
' (it's also possible to use the WinHttpRequest ActiveX object instead).
' (This method can be used with files which reside on a local or a network drive. It cannot download files from the Internet.)
' From: http://www.automatedqa.com/forums/forum/post/?mode=singleThread&thread=fb361ccf-ce86-4270-b427-dfe779d10966
Function DownloadFile()
' Specify the source and destination file names
Dim strFileURL
Dim strHDLocation
Dim objHTTP
Dim objADOStream
Dim objFSO
strFileURL = "http://www.mywebsite.com/file_to_get"
strHDLocation = "c:\\temp\\filename"
DownloadFile = ""
' Download the file
Set objHTTP = Sys.OleObject("MSXML2.XMLHTTP")
'or
'Set objHTTP = Sys.OleObject("WinHttp.WinHttpRequest.5.1")
Call objHTTP.open("GET", strFileURL, false)
Call objHTTP.send()
If (200 = objHTTP.Status) Then
Set objADOStream = Sys.OleObject("ADODB.Stream")
Call objADOStream.Open()
objADOStream.Type = 1 ' adTypeBinary
Call objADOStream.Write(objHTTP.ResponseBody)
objADOStream.Position = 0 ' Set the stream position to the start
Set objFSO = Sys.OleObject("Scripting.FileSystemObject")
If (objFSO.FileExists(strHDLocation)) Then objFSO.DeleteFile(strHDLocation)
Call objADOStream.SaveToFile(strHDLocation)
Call objADOStream.Close()
End If
End Function
'-------------------------------------------------------------------------------