4
A
回答
-2
为什么不只是使用 wget.exe <url>
。您可以将该行放入批处理文件中,并通过Windows调度程序运行该行。
0
Sharepoint中文档的链接应该是一个静态URL。在任何解决方案中使用该URL来获取计划中的文件。
2
你也可以这样做:
try
{
using (WebClient client = new WebClient())
{
client.Credentials = new NetworkCredential("username", "password", "DOMAIN");
client.DownloadFile(http_path, path);
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
5
是的,它可以从SharePoint下载文件。 一旦你有文件的URL,它可以使用HttpWebRequest和HttpWebResponse下载。
附加示例代码
DownLoadDocument(string strURL, string strFileName)
{
HttpWebRequest request;
HttpWebResponse response = null;
request = (HttpWebRequest)WebRequest.Create(strURL);
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
request.Timeout = 10000;
request.AllowWriteStreamBuffering = false;
response = (HttpWebResponse)request.GetResponse();
Stream s = response.GetResponseStream();
// Write to disk
if (!Directory.Exists(myDownLoads))
{
Directory.CreateDirectory(myDownLoads);
}
string aFilePath = myDownLoads + "\\" + strFileName;
FileStream fs = new FileStream(aFilePath, FileMode.Create);
byte[] read = new byte[256];
int count = s.Read(read, 0, read.Length);
while (count > 0)
{
fs.Write(read, 0, count);
count = s.Read(read, 0, read.Length);
}
// Close everything
fs.Close();
s.Close();
response.Close();
}
您还可以使用复制服务的API的GetItem下载文件。
string aFileUrl = mySiteUrl + strFileName;
Copy aCopyService = new Copy();
aCopyService.UseDefaultCredentials = true;
byte[] aFileContents = null;
FieldInformation[] aFieldInfo;
aCopyService.GetItem(aFileUrl, out aFieldInfo, out aFileContents);
该文件可以作为字节数组检索。
相关问题
- 1. 如何以编程方式从Sharepoint文档库下载文件
- 2. 如何以编程方式从网站下载文件c#
- 3. 如何以编程方式在Sharepoint站点发布HTML文件
- 4. 如何以编程方式在Sharepoint站点创建文件夹
- 5. 如何以编程方式在SharePoint中下载文档?
- 6. 如何以编程方式从网站下载图片?
- 7. 如何以编程方式从Google Play下载APK文件?
- 8. 如何从Sharepoint Librarly下载文档并以编程方式在ASP.NET中显示?
- 9. 如何以编程方式从Hive访问Sharepoint资源文件?
- 10. 以excel格式以编程方式下载sharepoint报告
- 11. 以编程方式从网站下载嵌入式SWF?
- 12. 从sftp站点下载文件 - 如何?
- 13. 如何以编程方式将文章页面添加到SharePoint站点?
- 14. 如何基于站点模板以编程方式创建SharePoint 2010网站
- 15. 如何以编程方式使用IOS(iPhone,iPad)下载文件?
- 16. 如何以编程方式下载大文件在C#中
- 17. 如何使用JS(Internet Explorer)以编程方式下载文件
- 18. 以编程方式下载Google文档?
- 19. 以编程方式从plumtree知识目录中下载文件
- 20. 以编程方式从filehoster下载文件
- 21. SharePoint以编程方式将内容写入站点导航
- 22. 以编程方式更改站点的sharepoint图标
- 23. 以编程方式更改Sharepoint站点URL
- 24. 以编程方式将SharePoint子站点迁移到其他站点集合
- 25. SharePoint 2007 - 如何以编程方式创建网站模板
- 26. 如何以编程方式获取所有SharePoint团队网站?
- 27. 如何通过python从Google Storage以编程方式下载文件?
- 28. 如何以编程方式从服务器下载文件夹到手机?
- 29. 如何从织物或Jenkins以编程方式下载.apk和.ipa文件?
- 30. Sharepoint 2010 - 对象模型 - 以编程方式下载DocumentSet
有没有软件可以做到这一点? – 2009-04-07 14:54:32