targetWebsite = SPControl.GetContextWeb(Context).Webs.Item("sites/IT")Dim folder As SPFolder = targetWebSite.GetFolder(targetFolder)Dim NewFile As SPFile = folder.Files.Add(fileName, fileContents)Return NewFile.Title + " created " + NewFile.TimeCreated.ToLongDateString()
]
[Client code:DialogResult = OpenFileDialogUpload.ShowDialog()If DialogResult = DialogResult.OK Then
sFilePath = OpenFileDialogUpload.FileNamesFileName = sFilePath.Substring(sFilePath.LastIndexOf("\") + 1)Dim fStream As IO.FileStream = CType(OpenFileDialogUpload.OpenFile, IO.FileStream)Dim nBytes As Integer = CInt(fStream.Length)Dim binFile(nBytes) As Byte' get the file contents into a bufferDim nBytesRead As Integer = fStream.Read(binFile, 0, nBytes)' send the document to sharepointDim spf As New SPFiles.SPFilesspf.Credentials = System.Net.CredentialCache.DefaultCredentialsMessageBox.Show(spf.UploadDocument(sFileName, binFile, sDestination))
End If
This topic is currently active on a newsgroup thread
Remember Me
a@href@title, strike
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.