简体   繁体   English

获取SharePoint文档库中项目的URL

[英]get url of items in sharepoint document library

i have a document library in sharepoint 我在sharepoint中有一个文档库

what is the field called for the url of the uploaded documents? 上载文件网址的字段是什么? see commented line below to see what i am trying to do 看到下面的评论行,看看我要做什么

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();

I am afraid that you will not be able get the URL directly. 恐怕您将无法直接获取该URL。 FileLeafRef doent have the value full url. FileLeafRef的值具有完整的URL。 One Option I will suggest is to create a Calculated Column and generate the URL in that. 我建议的一个选择是创建一个计算列并在其中生成URL。

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

我对此不太确定(因为我不太熟悉SPDataource),但我最初的猜测是FileLeafRef

encoded absolute url 编码的绝对网址

is the name of the field. 是字段的名称。 I would highly recommend a using a tool to expose the schema of a list or at the very least write a little code to dump the fieldnames and values. 我强烈建议您使用工具来显示列表的架构,或者至少编写一些代码以转储字段名称和值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM