# Copying a file to SharePoint server?

**URL:** https://www.finalbuilder.com/forums/t/copying-a-file-to-sharepoint-server/377
**Category:** Discussion
**Created:** [March 1, 2007, 6:24am UTC](https://www.finalbuilder.com/forums/t/copying-a-file-to-sharepoint-server/377 "2007-03-01T06:24:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![paulstock](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/paulstock/32/45_2.png) [@paulstock](https://www.finalbuilder.com/forums/u/paulstock)
#### Post date: [March 1, 2007, 6:24am UTC](https://www.finalbuilder.com/forums/t/copying-a-file-to-sharepoint-server/377/1 "2007-03-01T06:24:09Z")

</div>

After my build has finished, I would like to be able to have FB copy the setup file to my SharePoint site.&nbsp; Anyone tried doing this before?&nbsp; I can’t figure out how to get it copied to the server.  
  
Thanks

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [March 1, 2007, 10:18am UTC](https://www.finalbuilder.com/forums/t/copying-a-file-to-sharepoint-server/377/2 "2007-03-01T10:18:43Z")

</div>

Hi Paul  
  
We don’t currently have any built in support for sharepoint, however you should be able use some VBScript to do this, I found this script via google (should be able to create an action using ActionStudio too) :  
  
Dim objCN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'As ADODB.Connection  
Dim objRec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'As ADODB.Record  
Dim objStream&nbsp;&nbsp; 'As ADODB.Stream  
Dim strFileURL&nbsp; 'As String  
Dim strFilePath 'As String  
Dim strCC&nbsp;&nbsp;&nbsp; 'As String  
  
Const adModeReadWrite = 3  
Const adCreateNonCollection = 0  
Const adCreateOverwrite = 67108864  
Const adDefaultStream = -1  
Const adTypeBinary = 1  
  
&nbsp;'Replace these values with real paths  
strFileURL = "[http://servername/portalname/documents/documentname.doc](http://servername/portalname/documents/documentname.doc)"  
strFilePath = “C:\Temp\documentname.doc”  
  
&nbsp;'This is the default content class for documents  
&nbsp;'However, different profiles use other content classes  
strCC = "urn:content-classes:document"  
  
Set objCN = CreateObject(“ADODB.Connection”)  
objCN.Provider = "ExOLEDB.DataSource"  
objCN.open strFileURL  
  
Set objRec = CreateObject(“ADODB.Record”)  
objRec.open strFileURL, objCN, adModeReadWrite, adCreateNonCollection + adCreateOverwrite  
objRec.Fields(“DAV:contentclass”) = "urn:content-classes:document"  
objRec.Fields(“urn:schemas:mailheader:content-type”) = "application/octet-stream"  
objRec.Fields.Update  
&nbsp;&nbsp;&nbsp;   
Set objStream = objRec.Fields(adDefaultStream).Value  
With objStream  
&nbsp;&nbsp;&nbsp; .Type = adTypeBinary  
&nbsp;&nbsp;&nbsp; .SetEOS  
&nbsp;&nbsp;&nbsp; .LoadFromFile strFilePath  
&nbsp;&nbsp;&nbsp; .Flush  
End With  
  
objRec.Close  
objCN.Close  
  
Set objStream = Nothing  
Set objRec = Nothing  
Set objCN = Nothing  
  
HTH
