将文件上载到sharepoint:VBA
当我使用下面的代码时,不会将任何文件复制到sharepoint中,但代码不会显示错误。有人能帮我吗将文件上载到sharepoint:VBA,vba,sharepoint,upload,Vba,Sharepoint,Upload,当我使用下面的代码时,不会将任何文件复制到sharepoint中,但代码不会显示错误。有人能帮我吗 Dim SharepointAddress As String Dim LocalAddress As String Dim objNet As Object Dim FS As Object SharepointAddress= "\\xxxx\sites\xxx\xxx" ' Where you will enter your location path LocalA
Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object
SharepointAddress= "\\xxxx\sites\xxx\xxx"
' Where you will enter your location path
LocalAddress = "yourfile path\test.xlsx"
' Where you will enter the file path, e.g.: Excel file
Set objNet = CreateObject("WScript.Network")
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists(LocalAddress) Then
FS.CopyFile LocalAddress, SharepointAddress
End If
Set objNet = Nothing
Set FS = Nothing
请尝试下面提到的power shell步骤来上载您的文档,或者尝试通过浏览器视图复制并跳过您的文档
$WebURL = <site url(http://portal.contoso.com/sites/stuff)>
$DocLibName = "<document library name>"
$FilePath = "file path(your local machine)"
$Web = Get-SPWeb $WebURL
$List = $Web.GetFolder($DocLibName)
$Files = $List.Files`enter code here`
$FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)
$File= Get-ChildItem $FilePath
$Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(),$false)
$web.Dispose()
$WebURL=
$DocLibName=“”
$FilePath=“文件路径(您的本地计算机)”
$Web=获取SPWeb$WebURL
$List=$Web.GetFolder($DocLibName)
$Files=$List.Files`在此处输入代码`
$FileName=$FilePath.Substring($FilePath.LastIndexOf(“\”)+1)
$File=获取子项$FilePath
$Files.Add($DocLibName++“/”++$FileName,$File.OpenRead(),$false)
$web.Dispose()
请尝试下面提到的power shell步骤来上载您的文档,或者尝试通过浏览器视图复制并跳过您的文档
$WebURL = <site url(http://portal.contoso.com/sites/stuff)>
$DocLibName = "<document library name>"
$FilePath = "file path(your local machine)"
$Web = Get-SPWeb $WebURL
$List = $Web.GetFolder($DocLibName)
$Files = $List.Files`enter code here`
$FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)
$File= Get-ChildItem $FilePath
$Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(),$false)
$web.Dispose()
$WebURL=
$DocLibName=“”
$FilePath=“文件路径(您的本地计算机)”
$Web=获取SPWeb$WebURL
$List=$Web.GetFolder($DocLibName)
$Files=$List.Files`在此处输入代码`
$FileName=$FilePath.Substring($FilePath.LastIndexOf(“\”)+1)
$File=获取子项$FilePath
$Files.Add($DocLibName++“/”++$FileName,$File.OpenRead(),$false)
$web.Dispose()
解决方案1(使用Shell复制到WebDav目录中):
解决方法2:
使用vba外壳和一些控制台应用程序,在没有网络驱动器的情况下完成此操作
例如WinSCP或DavCopy或Curl,甚至PowerShell(请参见)解决方案1(使用Shell复制到WebDav目录中):
解决方法2:
使用vba外壳和一些控制台应用程序,在没有网络驱动器的情况下完成此操作
例如WinSCP或DavCopy或Curl,甚至PowerShell(请参见)有人能建议一些替代方法或帮助我解决此问题吗如果这不会引发错误,您确定使用的路径正确吗?是的,benno..文件路径正确..在提供本地地址路径时是否需要指定文件名?是否有人可以建议其他方法或帮助我解决此问题如果这不会引发错误,您确定使用了正确的路径吗?是的benno..文件路径是正确的..在提供本地地址路径时是否需要指定文件名?