How do I use a list from a different site in MOSS?
Asked Answered
U

6

6

I have an announcements list on one site. I want to add it as a web part to the top of each subsite. How can I do this in MOSS?

Unite answered 18/9, 2008 at 14:6 Comment(0)
P
1

Out of box that is not possible. Lists are limited to one site only.

The only option you have is to use content query web part (available in SharePoint Standard or better).

Here is how you can use CQWP.

There is also enhanced - community edition here.

You can embed these in your subsite templates.

Pleuro answered 18/9, 2008 at 14:31 Comment(0)
M
4

I've used the Data View Web Part in this case. Create a web service data source to get the data from the other site's list.

Much like this:

http://www.sharepointblogs.com/ssa/archive/2007/02/23/showing-web-service-data-in-a-data-view-web-part.aspx

Muff answered 18/9, 2008 at 14:30 Comment(0)
P
2

A couple of points.

First, you specified that you are using WSS 3.0, so the CQWP is not available (you need MOSS and to have publishing turned on for this to be available). The enhanced community edition will also not work for you since it derives from the CQWP.

Second, I would agree with Eugene Katz that a DataFormWebPart would be an easy approach, and I have a slightly different way of producing it than the link he posted presents. In Sharepoint Designer, open your desired site you want to place the web part on. Select the Data Source Library from the Task Panes menu, then click on "Connect to another library..." at the bottom of the pane, and browse/select your parent site that contains the announcement list. Now you can just add your announcement as a DataFormWebPart from the newly created node on the Data Source Library pane just as if it was on your site. Sharepoint Designer help shows how to do this if you are unfamiliar.

After you have set up your DataFormWebPart to your liking, you can make adding this to additional sites much easier by doing the following: Highlight your newly built DataFormWebPart and select File/Export/Save Web Part to.../Site Gallery. It will now be available throughout the site collection as an addable web part.

Pierson answered 21/9, 2008 at 18:49 Comment(0)
P
1

Out of box that is not possible. Lists are limited to one site only.

The only option you have is to use content query web part (available in SharePoint Standard or better).

Here is how you can use CQWP.

There is also enhanced - community edition here.

You can embed these in your subsite templates.

Pleuro answered 18/9, 2008 at 14:31 Comment(0)
L
0

The Content Query Web Part or the open source Enhanced Content Query Web Part are good ways to accomplish this.. If you don't have MOSS but WSS, Mr. Katz's and Mr. Ashwin's answers are acceptable but different ways to answer this question.

Lop answered 18/9, 2008 at 14:6 Comment(3)
Well I said that it is available only in SharePoint Standard or better.Pleuro
I have corrected the question. I meant MOSS when I asked the question.Unite
Frenki, you did say that. No disrespect meant. Ryan, thanks for clarifying.Lop
W
0

You should be getting the SPList object of that particular list using SharePoint Object Model. Once u get the same, you can render the list using the RenderAsHtml() Method. Please note that the RenderAsHtml() Method takes an SPQuery Object as parameter. You need to create an SPQuery object with the appropriate Query string. This code could go into the override of the RenderWebPart() method of a custom webpart:

SPSite site = new SPSite(siteURL);

SPWeb web = site.OpenWeb(webName);

SPList list = web.Lists[listName];

SPQuery query = new SPQuery();

query.Query = queryString;

string html = list.RenderAsHtml(query);

output.Write(html); //output is the HtmlTextWriter object in the RenderWebPart method.

Wheatley answered 18/9, 2008 at 16:36 Comment(0)
C
0

A really great web part for doing this is the Content By Type web part on Codeplex. It also supports showing items of a given content type from any list in any subsite.

See: http://www.codeplex.com/eoffice

Comradery answered 22/9, 2008 at 4:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.