简体   繁体   English

跨站点数据wss 3.0共享点

[英]Cross site data wss 3.0 sharepoint

I am trying to create a web part which will list all the items from the site collection ie from each web site's document library. 我正在尝试创建一个Web部件,该部件将列出网站集中的所有项目,即每个网站的文档库中的所有项目。 I am using the following code. 我正在使用以下代码。

        SPWeb web = SPContext.Current.Web;
        SPSiteDataQuery query = new SPSiteDataQuery();

        //Ask for all lists created from the document library template.
        query.Lists = "<Lists ServerTemplate=\"101\" />";

        // Get the Name field.
        query.ViewFields = "<FieldRef Name=\"Title\" />";                               

        // Set the sort order.
        query.Query = "<OrderBy>" +
                          "<FieldRef Name=\"Created\" Ascending=\"False\" />" +
                      "</OrderBy>";

        // Query all Web sites in this site collection.
        query.Webs = "<Webs Scope=\"SiteCollection\" />";

        DataTable dt = web.GetSiteData(query);
        DataView dv = new DataView(dt);

My site collection contains nested sub sites and work spaces with different document libraries. 我的网站集包含具有不同文档库的嵌套子网站和工作空间。 The web part is rendered perfectly but it only shows the column Title because it is specified in ViewFields. Web部件呈现完美,但是仅显示“标题”列,因为它是在ViewFields中指定的。

Is it possible to show the column Name (linked to document with edit menu), so that each item will be appeared as hyperlink and on click of this link it will open the item in respective application eg in Microsoft Word 2007. 是否可以显示“名称”列(通过编辑菜单链接到文档),以便每个项目都将显示为超链接,并且在单击此链接时,它将在相应的应用程序(例如Microsoft Word 2007)中打开该项目。

Please help me in this regard. 请在这方面帮助我。

Try using SPGridView . 尝试使用SPGridView An example is located here . 这里有一个例子。

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

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