I have managed to put together below code to upload a text file to sharepoint. However it throws a permission denied error even when I manually login to sharepoint first and then run this code. Can someone help me? I can enter credentials if I get a way to do that. Best solution would be to ask user to enter his own credentials so that the same gets reflected on sharepoint. Appreciate any help on this!
Sub UploadToSharepoint()
Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As WshNetwork
Dim FS As Object
SharepointAddress = "some address<sharepoint slashes="" backward="" with="" replaced="" forward="" and="" removed="" is="" word="" http="" where="" path=""></sharepoint>"
LocalAddress = "some address<detailed name="" with="" included="" file="" address="" local="">"
Set objNet = New WshNetwork
Set FS = New Scripting.FileSystemObject
objNet.MapNetworkDrive "Z:", SharepointAddress
If FS.FileExists(LocalAddress) Then
FS.CopyFile LocalAddress, SharepointAddress
End If
objNet.RemoveNetworkDrive "Z:", SharepointAddress
Set objNet = Nothing
Set FS = Nothing
End Sub</detailed>
Sub UploadToSharepoint()
Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As WshNetwork
Dim FS As Object
SharepointAddress = "some address<sharepoint slashes="" backward="" with="" replaced="" forward="" and="" removed="" is="" word="" http="" where="" path=""></sharepoint>"
LocalAddress = "some address<detailed name="" with="" included="" file="" address="" local="">"
Set objNet = New WshNetwork
Set FS = New Scripting.FileSystemObject
objNet.MapNetworkDrive "Z:", SharepointAddress
If FS.FileExists(LocalAddress) Then
FS.CopyFile LocalAddress, SharepointAddress
End If
objNet.RemoveNetworkDrive "Z:", SharepointAddress
Set objNet = Nothing
Set FS = Nothing
End Sub</detailed>