获取sharepoint文档库中的项目URL

时间:2009-06-30 17:48:16

标签: c# sharepoint

我在sharepoint中有一个文档库

上传文件的网址名称是什么? 请参阅下面的注释行,看看我想做什么

SPDataSource dataSource = new SPDataSource();
dataSource.List = site.RootWeb.Lists["myList"];

 this.myDropDownList.DataSource = dataSource;
 this.myDropDownList.DataTextField = "Name";
 //this.myDropDownList.DataValueField = "URL";// what should this be??
 this.myDropDownList.DataBind();

4 个答案:

答案 0 :(得分:2)

我担心您无法直接获取该网址。 FileLeafRef doent的值为full url。我建议的一个选项是创建一个计算列并在其中生成URL。

答案 1 :(得分:2)

SPListItem具有FileRef和FileLeafRef字段(取决于它们是“常规项”(FileRef)还是“文档项”(FileLeafRef),但它们不是服务器相对URL。

答案 2 :(得分:0)

我对此并不十分肯定(因为我不熟悉SPDataource),但我最初的猜测是 FileLeafRef

答案 3 :(得分:0)

编码绝对网址

是该字段的名称。我强烈建议使用工具来公开列表的模式,或者至少写一些代码来转储字段名和值。

相关问题