Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've got a Contact list with info about departments in our organization. The list is at the department level, not person level. It has the following columns:

Department
Title ["Contact Helpdesk:", "Contact Accommodations:", etc.]
Address
URL
E-Mail
Phone
Opening Hours

I'd like to create a web part for this list so it can be dropped on any page within our SharePoint 2010 site and then filter it on a specific department. It would then show the contact info for that department as something like this:

Contact Helpdesk:

Room 123, ITC Bldg., 3rd Floor
http://www.oursite.org/helpdesk
helpdesk@oursite.org
999-456-1234

Opening Hours:
Sunday - Thursday: 10 - 5

Do I do this in SharePoint Designer? or InfoPath? It needs to be a reusable part we can drop on various parts of the site. As a newbie, I'm lost in the HTML/XML of the Designer program and don't know how to format the elements so they show the way I need. The list doesn't need any paging; just the elements for that one item that's been filtered.

Thanks.

share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

I did something similar to this. What I had was a list, Department Contact, under each Department site. It was just a custom list that I saved as a list template (easy to recreate across all departments).

I then created a Data View Web Part in Designer that linked to the list. Admittedly, I used a table format for the output because it's just easier (I know...that's a no-no). So, a snippet would look like this:

For more help with XSL, check out W3Schools.org. Also, if it's a little overwhelming looking at the XSL in SPD, try Visual Studio or another XSL editor (a bunch of freebies, I'm sure). Copy and paste back and forth.

The other thing I did to the DVWP is change the Data Sources XML to reference by ListName instead of ListID. By doing this, it will allow you to reuse the web part on any site with a list named "Department Contact." To do this:

  • change Name="ListID" to Name="ListName"
  • change ParameterKey="ListID" to ParameterKey="ListName"
  • chane DefaultValue="[GUID]" to DefaultValue="[ListName]"

Screen shot of DataSources element: http://i.stack.imgur.com/OEe5c.png

Once this is done, save the Web Part to the WP Gallery and now it's usable across the Site Collection.

share|improve this answer
    
Thanks SPSamL. That's exactly what I'm trying to do. I'm going to update the Data Sources XML also to follow your example. –  Alex C Jul 13 '11 at 9:59
    
A follow-up: For reusing the web part, when you say Name="ListName", is that literally my list's name typed in there? So I'd type Name="MyContactList"? Same thing for the other values you changed. Also, I noticed that the GUID has {} curly braces around it; should I put that on mine or just use brackets []? –  Alex C Jul 13 '11 at 10:31
    
You'll want to remove {12345678-1234-1234-1234-1234567890ab} and replace with MyContactList. The [] are just to note full replace for this post. –  Sam Larko Aug 29 '11 at 18:55
add comment

I wouldn't use either Designer or InfoPath; instead, I would use a Content Editor Web Part along with a jQuery script to format the data the way you want it on the page.

The steps would be:

  1. Add the jQuery script library (file) to a document library on your SharePoint site. jQuery can be downloaded here.
  2. Add a Content Editor Web Part to your page
  3. Set the source of the content editor web to the DispForm and ID of the specific list item you want to display
  4. Craft a jQuery script to modify the display so that the list columns appear the way you want them.
  5. Save the jQuery script to the document library and link it to your HTML, or optionally insert it inline. It will be easier to maintain if you link it and store the file elsewhere.

Although steps 4 and 5 seem daunting, jQuery is very easy to learn if you know a little JavaScript already. There are many examples on the internet of how to use jQuery, and many of its capabilities work well with SharePoint UI coding.

I'll also mention that Internet Explorer has a F12 debug mode useful for inspecting page layout. I used this to figure out the structure of pages, which you will need to do to figure out how the DispForm elements are presented. Even if you're not a regular IE user, I think you'll find it useful to employ IE for your coding tasks here.

share|improve this answer
add comment

Where and how you want to manage the content should dictate where you store the list with the data. It can either be centrally stored for all sites or distributed in a list per site.

Once you have the list(s) in place, I'd recommend using a DVWP to display the data. If you store the data in a centralized list, you can add a column for the site URL and filter you DVWP accordingly. You can also store the XSL which drives all of the DVWPs centrally in a separate file to facilitate easy across-the-board changes to the output format.

share|improve this answer
    
Thanks, Marc. Is there a good online tutorial for this you can point me to? I've found a few tutorials, but they don't quite get me what you just described. Thank you :) –  Alex C Jul 13 '11 at 12:02
    
Probably not specifically what you want. –  Marc D Anderson Jul 13 '11 at 16:17
    
Found this for creating a reusable data view web part: sharepointkevin.com/Lists/Posts/Post.aspx?ID=21 –  Alex C Jul 14 '11 at 5:00
    
Thanks, Marc. Do you mind elaborating on the site URL column and the filter for that? I've created the DVWP and installed it on SP. I'm able to open the web part and edit it in Designer, but the filter options are all grayed out; it only lets me edit in code view. Thanks. –  Alex C Jul 14 '11 at 12:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.