in

Raymond Mitchell

November 2007 - Posts

  • Out of the Box Composite Apps - Connected Web Parts

    Now that we have two related lists, it would be nice to filter our list of Products by Vendor.  We can easily accomplish this using out of the box List View Web Parts (LVWP).

     

    First we’ll create a new page to host our Web Parts by going to our Pages library:

     

    And selecting a title and Web Part Layout Template:

     

    Next we’ll add a LVWP for our Companies list by clicking “Add a Web Part”:

     

    Then select the Company List:

     

    And click Add:

     

    Now we can similarly add the Products LVWP:

     

     

     

    Now that we have both Lists represented on our page, we can configure the LVWPs’ connections to filter products by Vendor.  To do this, start with the Products List and from the edit menu select Connections, Get Sort/Filter From, Company:

     

    Select the column in the Company list you wish to filter with (Title):

     

    Then choose the column in the Products list you wish to filter (Vendor):

     

    The page will refresh and you will see radio buttons next to each Company:

     

    Now when you select a Company, the Products list will be filtered to show only products from the selected Vendor:

     

    One last edit to keep things consistent - let's change the title of the Company LVWP to match our filter.  To do this, select the edit menu for the Company LVWP and choose Modify Shared Web Part:

     

    In the task pane, update the Title of the Web Part in the Appearance section:

     

    And then press OK.  When you exit edit mode, you’ll have your filterable Products by Vendor Page:

     

  • Out of the Box Composite Apps - Lookup Columns and Related Lists

    One of the powerful features in SharePoint is that it allows you to lookup data from another list giving you the ability to create relationships between your Lists and Libraries.   To show how this works, let’s create a Company list and relate it to our Products list.

     

    Begin by creating a simple custom list:

     

     

     

    Next we’ll add some sample data using the Datasheet view:

     

     

     

    The Datasheet view allows you to quickly add/update/delete items in a list.  It is available for most list types, including Libraries (great for deleting multiple documents at once):

     

    Now that we have a list of Companies, let’s add a column to our Products list to show the vendor we are using for each Product:

     

    First enter the column’s name and select “Lookup” as the type of column you would like:

     

    Next, configure where the lookup should get its information from:

     

    Now we have a new column on our Products list:

     

    To add sample data, let’s use the Datasheet view again:

     

    Now the Vendor column can select list items from the Company list:

     

    When you return to the standard view of the Products list, you can see that the Vendor column is also a built-in hyperlink to the related Company list item:

  • Out of the Box Composite Apps - Custom Web Part Pages

    By creating custom views using the List View Web Part, you’re able to display lots of data in lots of different ways.  Up until now though, we’ve been putting those views on the homepage of our site (default.aspx).  In some scenarios that is just fine but there is another option within SharePoint.

     

    From your SharePoint site browse to the Create page:


    Select Web Part Page from the list:

     

    This brings you to the New Web Part Page form.  This form allows you to create a new .aspx page that will contain Web Part Zones for you to customize.  The form allows you to specify a Layout Template for the Web Part Page.  These Layout Templates (not to be confused with Layout Pages in MOSS!) specify how the Web Part Zones are placed on the Web Part Page.

     

     

    The last part of the form asks you where you want to save your Web Part Page.  When creating Web Part Pages through the SharePoint UI you must save the file in a Document Library on the site.  If you do not have an existing Document Library, the UI does allow you to create one from the New Web Part Page form.

     

    If you anticipate creating multiple pages I recommend creating a new Document Library (from the Create page, not from the link on the New Web Part Page form because it has some values hard-coded).  Back on the Create page, select Document Library from the list:

     

    The New Document Library form allows you to set a default Document Template of type Web Part page:

     

    Once the library has been created, when you select New Document:

     

    You are taken to a simplified version of the New Web Part Page form:

     

    Using this method allows you to quickly create new Web Part Pages to host your Web Parts:

  • Use PowerShell to list your Views

    In case you want to see what’s happening behind the scenes when you add a List View Web Part to your page, jump out to PowerShell (on the SharePoint server) and take a look:

     

     

    So what’s happening here?

     

    PS C:\> [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

    This lets me use the Microsoft.SharePoint assembly.

     

    PS C:\> $site = New-Object Microsoft.SharePoint.SPSite("http://wssdemo.spdemo.local/CA")

    PS C:\> $web = $site.OpenWeb()

    PS C:\> $list = $web.Lists["Products"]

    This creates an SPSite object, gets the SPWeb (which contains the site’s lists), and then gets the SPList object for the Products list.

     

    PS C:\> $list.Views | Format-Table

    This shows me some details about the list’s views in a (sort of) pretty table view

     

  • Out of the Box Composite Apps - The List View Web Part (LVWP)

    There’s another place you can customize how your list displays.  From any Web Part Page you can add a List View Web Part for a list that exists on the current site.

     

    ·         Open the page in Edit mode

     

    ·         Click on a Web Part Zone’s “Add a Web Part” button

     

    ·         Select the list or library you wish to display and click Add

     

     

    This will add a new List View Web Part to the page.  You’ll notice that the list is displaying in a view that matches the AllItems view.  What is really happening is when you create your first List View Web Part, an unnamed copy of the default view is created and associated with the LVWP.  You can actually see the hidden view from PowerShell.

     

    The nice thing about having a separate view is that the LVWP also allows you to modify the view right from the page that hosts your List View Web Part.  To update the view:

     

    ·         Choose Modify Shared Web Part from the LVWP’s edit menu

     

    ·         This will bring up the Web Part Task Pane.  From here you can select and exiting view to use or click on “edit the current view” to fully customize the view.

     

    ·         The Edit View page should look familiar, it uses the same List View editing form I talked about in my last post

     

     

     

  • Out of the Box Composite Apps - List Views

    Once you have created your custom list you’ll want to choose how to display your list items.  One view is already created for you and lives on the AllItems.aspx page.  To create a new view, hit the View dropdown and select Create View:

     

     

    On the Create View page, you’ll have the option to create a few different kinds of views.  The most exciting views are the Calendar and Gantt views, however, the Standard View is probably the type you’ll choose most often.  Also take note that you can start from an existing view and then customize it to your needs.

     

     

    Once you choose your view format, you’ll have a few customization options including:

    ·         Selecting which fields to display

    ·         Setting Sort & Filter properties

     

    ·         Configuring Grouping

     

    ·         Adding Totaling fields

     

    ·         And a few other options including setting basic styles, configuring item limits, how to handle folders, etc

     

     

    Once you have created your view, it will show up in the list’s View dropdown.  You should also note that the view exists on a new .aspx page matching the title of the view.

     

Inetium, LLC. Disclaimer