Wednesday, February 22, 2012

Use a list in a Web Part on any page in your site

You have proudly created a list with many assorted views. People love it so much they want the list for their sites in the same site collection. Trouble is, it’s not easy to make another list show up on other sites these days. You could use REST (Representational state transfer) or even Web services, but you don’t quite have the skills to do that. Fortunately, there’s another approach that’s much easier. All you have to do is save your list as a Web Part and then add the Web Part to any other page on your site. It’s surprisingly easy to do and doesn’t require any code. In the following example, I’ll assume you are working with a typical customer list.

Part 1: Save the List View to a Web Part file

  1. In the browser, go to the list and display the default view.
  2. To open the list in SharePoint Designer, in the ribbon, on the List tab in the Manage Views group, click the arrow next to Modify View, and then select Modify in SharePoint Designer (advanced).
  3. In SharePoint Designer, position the insertion point on any part of the list.
  4. Do one of the following:
    • If you have contribute permission and want to save the Web Part as a file, in the ribbon, click the Web Part tab, and in the Save Web Part group, click To File, click Save, enter a meaningful Web Part filename, such as Customers.webpart, and then click Save.
    • If you have site-level permissions and want to add the Web Part to the site Web Part gallery, in the ribbon, click the Web Part tab, and in the Save Web Part group, click To Site Gallery, click Save, enter a meaningful Web Part filename, such as Customers, and then click OK.
  5. When SharePoint Designer displays the following message:
  6. Click Yes. This ensures the list is accessible from any site of the current site collection.

Part 2: Add the Web Part to another page
  1. Go to the site you want to add the Customers Web Part to, click Site Actions, click New Page, enter Customers List in the New page name box, and then click Create.
  2. Do one of the following:
    • Add the Web Part from a file
      1. Under the Editing Tools tab group, click the Insert tab, and then in the Web Parts group, click Web Part.
      2. To make the Customers.webpart available to the page for insertion, click the arrow next to Upload a Web Part, click Browse, locate and select the Customers.webpart file created in Step 4 of Part 1, click Open, click Upload.
      3. Under the Editing Tools tab group, click the Insert tab, and then in the Web Parts group, click Web Part.
      4. Under Categories, click the newly created Imported Web Parts folder, under the Web Parts section, select Customers.webpart, and then under the About the Web Part section, click Add.
    • Add the Web Part from the Web Part Gallery
      1. Under the Editing Tools tab group, click the Insert tab, and then in the Web Parts group, click Web Part.
      2. Under Categories, click Miscellaneous folder, under the Web Parts section, select Customers.webpart, and then under the About the Web Part section, click Add.
  3. If you see an Information dialog box, entitled, Message from Web Page, ignore it, and then click OK.
  4. Click the arrow next to the Web Part menu, and then click Edit Web Part.
  5. In the Tool Pane, consider doing the following:
    • If you want a different view than the default view to display, under Selected View, select the view you want.
    • If you want to remove the Add New Item link at the bottom of the list, Under ToolBar Type, click No Toolbar.
    • If you want the List View Web Part to look like a regular list, In the Appearance section, under Chrome Type, click None.
  6. Click OK.
  7. In the ribbon, click the Page tab, and then click Save & Close.  

No comments:

Post a Comment