Pulling It All Together with the Site Aggregator Web Part

We saw last time how I can easily see all the documents in the current site that I last modified or created with the Relevant Documents web part. However, what do I do if I want to see all of my documents in any one of several different sites? Do I have to navigate to each of these sites and open a page with a Relevant Documents web part?

Fortunately, there is an easier way! The Site Aggregator web part allows me to view my documents stored in any number of sites from a single place, sort of.

After reading my last blog article, I’m going to assume you know how to add a web part onto a page in your site. (If you skipped that blog, you can always go back to it at: https://sharepointmike.wordpress.com/2015/06/27/) As with the Relevant Documents web part, the Site Aggregator can be found in the Content Rollup category for both SharePoint 2010 and SharePoint 2013. After adding the web part to the page, it looks something like the following:

At first, I may be puzzled by the text telling me to click on the “Add New Tab” icon. The first thing I should know is that each site that I want to pull documents from will be displayed separately and that I must choose the site I want to view by clicking on a tab/link across the top of the web part. To add a new tab, I need to click on the icon that appears in the top right of the Site Aggregator that looks like a drive icon with a yellow asterisk in its upper right corner.

This button displays a dialog that lets me enter the name of the site that I want to view. For example, the following figure shows a reference to a demonstration school site. Note that the URL does not point to a specific page. Rather it is the URL of the site only. Also notice that the URL must end with a slash ‘/’. The second property in this dialog is the name that will appear in the tab/link across the top of the Site Aggregator.

When I click the Create button, the Site Aggregator shows the contents of all libraries in the selected site and lets me click on the document name to open the document directly or by clicking on the location, to go to the document’s library.

So far, that works pretty much like the relevant documents web part. The feature that makes this web part different is that I can click on the Add New Tab to add another URL to a different site. In fact, I can add several new tabs as shown in the image below which includes separate tabs to view the documents found in each of the individual grade sub-sites for this virtual school.

Notice how the tabs/links can actually require more horizontal space than the size of the page. When this occurs, double angle brackets appear at the beginning and end of the row to allow me to horizontally scroll through the tabs. I can also use the down pointing arrow to the right of the Add New Tab button to open a dropdown menu of the available tabs.

If I open the web part properties as described for the Relevant Documents web part, I will see the properties that I can modify for this web part. As before, I may want to change the title for the web part that appears at the top of the web part.

Two additional unique properties to this web part are in the View and URL groups. The View group has a single property that lets me control the number of characters that appear in the tab/link before ellipses replace the balance of the characters. According to the documentation, this feature can be used to control the number of characters used in the label. I believe that in SharePoint 2010, I must allocate 2 characters of this number to the ellipses to determine the actual number of characters displayed. For example, a value of 10 allows for 8 characters plus the ellipses. In SharePoint 2013, this property seems to be ignored in my test site. But that may just be my site. What do you get?

The URL group prompts me for a character string that it will add to the URL provided when I define a new tab to specify exactly what is returned by the web part. The default string: _layouts/MyInfo.aspx uses a predefined view that displays content from the site library that shows documents that I modified or created.

However, it also appears possible to replace this string with others. For example I could enter the string: _layouts/SiteManager.aspx.

This string opens the Site Content and Structure view which displays all the documents in all the libraries for the site.

Note that I can navigate to other sites as well as the current site by using the leftmost panel and then by selecting different views, quickly determine which documents I have checked out, have modified, are pending approval, or are still in draft mode.

In future months, I may examine some of the other lesser used web parts and explore their use.


Are Your Lookup Lists Involved in a Relationship?

SharePoint 2010 adds the ability to define relationships between two SharePoint lists in which one list serves as a lookup to the other list. This capability existed in prior versions of SharePoint. However the lack of enforced relationships allowed users to modify the contents of the lookup list without considering whether individual lookup values were used by the referencing table. SharePoint 2010 corrects this missing feature by allowing the user to either restrict or cascade updates to the referencing list.

What does that mean? Suppose I have a list of Projects that my organization is working on. I want to use this project list as a lookup column source for a project field in a second list, such as a Lessons Learned list. In the Lessons Learned list, I define a column named Projects using the lookup column type. In the Additional Column Settings section, I edit the Get Information From field to point to Projects and use the Project Name column as the source for the In This Column field. This definition establishes the link as shown in the figure below.

Note that once I link the Project list to another list, I can also bring along any of the other fields in that list such as the Project Manager field to be displayed with the data in the Lessons Learned list. The emphasis on displayed comes from the fact that while the Lessons Learned list displays the project manager’s name associated with the selected project, I cannot change that name in the referencing list. I can only change the Project Manager’s name in the Projects list. Furthermore, the column name associated with the project manager’s name will be the concatenation of the list and column name of the lookup, Referenced Projects:Project Name in this case.

If I do not do anything else when defining the lookup, it would be possible for someone to come into the Projects list and change the name of a project that is already linked to one or more lessons learned or even to delete the project from the Projects list. Anyone familiar with referential integrity would refer to this action as creating an orphaned reference in the lessons learned table since the referenced project would no long exist.

In SharePoint 2010, a Relationship section was added to allow the list designer to enforce relationship behavior. The designer has three possible options. First, I can choose to ignore the enforcement of any relationship. Sometimes, this is the correct solution especially if I do not want to change the historical value of the lookup over time that could change the lookup values. Another possibility is to use the Restrict Delete option. This option prevents changes to the values in the lookup list that have already been used at least once in the referencing list. In other words, it would prevent changing the project name if that project had at least one lessons learned record. Finally, the third option is Cascade Delete. With this option, if I change the project name in the lookup list, SharePoint cascades that change to all lessons learned records automatically. Similarly, if I delete a project from the lookup list, it deletes all lessons learned records for that project.

With either relationship enforcement options, I must index the column before the referential connection can be created. This is similar to the behavior of referential fields in a database which require the linking fields to be indexed. The difference is that only the linking field in the referencing list must be indexed within SharePoint. If that field does not contain an index, SharePoint prompts for one using the following dialog.

Clicking OK builds the index and creates the relationship. I can review the relationships defined for a list by selecting List Settings from the List ribbon and scrolling to the last link in the Columns section to display the Indexed columns.

SharePoint then tells me the number of indices the current list has and the fields associated with each one.

In a similar fashion, I could add referential lookup columns to the Lessons Learned table for up to 20 different fields in the table. Let’s suppose I have three referential columns and therefore, three indexed columns as shown here.

Note that in order to review the type of referential link each field uses, I must return to the individual lookup table and review the properties of the lookup column. If I change the referential enforcement option, that change applies only to new or edited records going forward, not existing records that are not edited.

For the purposed of this example, I defined the Project lookup to be a Cascade Delete and the Status and Lesson Type lookups to be a Restrict Delete.

Let’s now add our first Lesson Learned as shown in the following figure.

For the purposes of this example, suppose I add a few more records to the Lessons Learned list so that the first few records look like the following figure.

Now suppose that I go into the Lesson Type list and decide that I want to delete the Coding option from the list. However, I already used the Coding lesson type in at least one Lesson Learned item (see above).

Upon clicking Delete Item from the options dropdown menu, I get a message first asking me if I am really sure that I want to do this. (Personally, I think SharePoint should check the referential option first and if Restrict Delete is set as it is here, to skip over this question.)

After confirming that I do want to delete this item from the lookup table, SharePoint tells me that it cannot delete the item because it is used in the Lessons Learned list.

(Note: Although the option Restrict Delete is in effect, changes to the lookup value will always cascade down to the referencing list.)

Next, let’s look at the Project lookup list. In the Lessons Learned list, I defined this relationship as a Cascade Delete. Next I go into the Project list and delete Project 1 at this point as shown in the following figure.

I would first get a warning message such as the one shown below that tells me that any related items in the Lessons Learned list will also be sent to the recycle bin and would ask me if I was really sure I wanted to do this.

If I click the OK button, not only does the project get deleted from the Project list, but SharePoint also deletes all of the lessons learned related to that project as you can see from this last figure of the Lessons Learned list which no longer has any lessons from Project 1.

That’s all for now.

C’ya next time.