Sunday, February 28, 2010

Access lists from subsites (here we go again)

Where did "Connect to another library..." go?

It is gone (at least for beta). My fix is to create a fully filtered and customized data view webpart in the root site, and then export it to a file to add to a subsite later.
You can also use the Content Query Web Part.

Here goes a post from someone on the inside:

"unfortunately, we removed the UI for connecting to other lists. This feature had some issues in 2007, so we decided to cut it. Here are a couple workarounds in SPD 2010:

1. If you are a site collection admin, you can go to the library's view in SPD and save it to the web part gallery (web part tab > save to gallery). From there you can insert it into any site in that site collection.

2. If you are not a site collection admin, you can go to the library's view in SPD and save it to a file (web part tab > save to file). From there you can drag and drop the file onto the design surface.

These touch on what I meant to say in my previous comment - "and you can save some views [as] web parts."
by KolbyH (MSFT)

EDIT #1:

if you add this to parameter bindings of webpart
<ParameterBinding Name="WebURL" Location="None" DefaultValue="{sitecollectionroot}"/>

and this to data form parameters
&lt;webpartpages:DataFormParameter ParameterKey="WebURL" PropertyName="ParameterValues" DefaultValue="{sitecollectionroot}" Name="WebURL"></webpartpages:DataFormParameter&gt;

exported webparts do indeed work in subsites!

EDIT #2:
Here's how you do it:
- Create a blank web part part in the parent site
- Create a New Empty Data Viewer Web Part
- Left click, "Select data source", select a list
- Save file and open it on browser: Click context arrow, "Export"
- Edit saved web part file, add both lines above in matching places
- Upload webpart to subsite page
- Edit subsite's page with web part in SharePoint Designer!

All this work is the same as in SPD 2007, clicking "Connect to another library..."

Sad but true. Lets see what the RTM version has to say about this.

Server Relative URL:

<asp:Parameter Name="WebUrl" DefaultValue="/subweb"/>

Site Collection Relative:

This is in context of the site collection root for the opened web. For example, assume my site collection root is: http://server/sites/sitecollection/

This parameter opens this web: http://server/sites/sitecollection/subweb2

<asp:Parameter Name="WebUrl" DefaultValue="subweb2"/>

Site Collection Root itself:

<asp:Parameter Name="WebUrl" DefaultValue="{sitecollectionroot}"/>

Alternatively you can also use WebID.

<asp:Parameter Name="WebId" DefaultValue="SomeGuid"/>

These parameters are compatible with both the ListId and ListName parameters.

No comments:

Post a Comment