从Sharepoint中的文档库下载文件 [英] downloading a file from a document library in Sharepoint
问题描述
下面是我用来从Sharepoint文档库下载.csv文件的脚本.但是我也在下面发布了错误.请注意,我需要使用一组不同的凭据才能登录到Sharepoint网站(本地). 有什么帮助吗?
Below is the script I'm using to download a .csv file from a Sharepoint document library. However I am getting the error posted also below. Take note that I need to use a different set of credentials to be able to login to the Sharepoint site (on-prem). Any help on this?
SCRIPT1
=================
==================
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction静默继续
$ Username =" DOMAIN \ MyUsername"
$ Password = Get-Content -Path "D:\ Scripts \ AriesN \ SecureString.txt"
$ Credential =新对象-TypeName System.Management.Automation.PSCredential -ArgumentList $ Username,$ Password
$ FromFile =" http://< sharepoint网站>/filename.csv"
$ Tofile =本地目标路径"
$ webclient =新对象System.Net.WebClient
$ webclient.Credentials =新对象System.Net.Networkcredential($ Username,$ Password)
$ webclient.downloadfile($ fromfile,$ tofile)
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue
$Username = "DOMAIN\MyUsername"
$Password = Get-Content -Path "D:\Scripts\AriesN\SecureString.txt"
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username,$Password
$FromFile = "http://<sharepoint site>/filename.csv"
$Tofile = "Local Destination path"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.Networkcredential($Username,$Password)
$webclient.downloadfile($fromfile,$tofile)
===============
===============
错误
+++++++++++++++++++
+++++++++++++++++
PoSH新手,BaSH Oldie
PoSH newbie, BaSH Oldie
推荐答案
请说明这与Microsoft Exchange Server 2013的关系,因为您在那发布了它.
Please explain how this relates to Microsoft Exchange Server 2013, since that's where you posted it.
这篇关于从Sharepoint中的文档库下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!