Lists in SharePoint are a very convenient way to store and share information. Now with SharePoint 2010, InfoPath form customization has made it much easier to create tailor-made forms for input and display of SharePoint list data. But when it comes to printing an individual list item in a manner which many companies still require, SharePoint 2010 does not have the tools available out-of-the-box. But with a little bit of work using Word and InfoPath a very user-friendly but powerful solution can be created. Here are the steps you will need to follow.

  1. Your starting point is the list which contains your information in SharePoint. In this example, it is a simple list called costs with four columns.

    Name (a simple text column, which was the default Title column of the list),

    Country of Origin (a choice column providing a list of countries),

    Family (a numeric column constrained to values between 0 and 5),

    Signed-Off (a Yes/No column).

  2. Next step is to create a Site Content Type, (Site Settings, Site Content Types, Create) based on the Document content type. In this example, the new Content Type is called Print-Item.

  3. You will need to create New Site Columns which match the names of columns in your list and add them to the Print-Item content type.
  4. Next up, design a Word template laid out in a manner that you would like to use for printing your list information. This could take the form of the example below:
  5. Save this Word file as a template somewhere (e.g. mydemotemplate.dotx) and then upload it to your new Print-Item content type under Advanced settings.

  6. Now create a new document library called Print and add your new Print-Item content type, after changing the Advanced settings to allow for the management of content types.

    Once the Print-Item content type is available, you can hide the default Document content type, by clicking on the Change new button order and default content type link and unchecking the Visible check-box.

  7. Now when you create a new document in the document library, you should see your Word template as designed earlier. If you display the Document Information Panel (File, Info, Properties, Show Document Panel), you will see your site columns associated with the content type:

  8. Now you can insert these into the document using Insert, Quick Parts, Document Properties and chose the appropriate document property for each column in your list:


    Then save your Word file again as .dotx template and upload it to your Print-Item content type once more.

  9. You are now in a position to edit the Document Information Panel which is associated with the Print-Item content type and link it to your list rather than the document library. Fire up InfoPath and choose the Document Information Panel template:

    Then enter the URL for your SharePoint site and choose the Print-Item content type:

  10. Next right-click the Title field and Change Control to a Drop-Down List Box. Then right click Title again and choose Drop-Down List Box Properties. Select Get Choices from an external data source, then Add and create a new connection to Receive data from a SharePoint list. Then select your list.

  11. Then select the columns you require from your SharePoint list.

    Once you have finished your Drop-Down List Box properties should appear as follows:

  12. Check using the Preview in InfoPath that the Drop-Down is picking up the items from your list.
  13. Next you will need to create as Rule for each of the other columns that you want to display in your Word file for printing. You do this by right-clicking the Drop-Down List Box, Rules, Manage Rules and add a new rule as an Action. The required action is to Set a field’s value:

    Choose from the Main data source, under properties, document management, in this case the first of our additional fields, Country of Origin.

    For the value of the field, click the browse button and select Insert Field or Group and switch to the Secondary data source, which in our example is our list called Costs:

    Then select the appropriate data field, in this case Country of Origin, and then click on the Filter Data… button.

    Click Add and then select the Name field as follows:

    making it is equal to the title field in the coreProperties of the Main data connection.

  14. This is probably a good point to make sure you have saved your InfoPath form and then click Preview to check that when you select from your Drop-Down List, the next field is populated correctly according the information in your SharePoint list.
  15. Repeat the procedure and create a new rule in exactly the same fashion as described above for each additional field you require. It may seem cumbersome at first, but once you get into the swing of it, you will race through the process. Just make sure you get the right data connections each time. It is a good idea to preview after each field to verify that all is correctly configured.
  16. When done, publish the newly customized document information panel to SharePoint and when you create a new document from in the Print library, you should be able to choose the item you want to print from your list, and see the information appear, as if by magic in your Word file:

  17. As my example shows, it is also worth checking the format of your display information too, as you could be forgiven for thinking I have several thousand children if you do not notice the decimal point.
Advertisements

SharePoint only shows users the links to which they have access. Correct? Well, kind of.

When you create a list or document library in SharePoint, one option at creation is to display a link in the Quick Launch menu to the left.

The default is “Yes” and your list, in this example, will appear under the Lists heading in the Quick Launch menu.

If you then restrict access to a list, as I have done in the case of the For Admins list above, when logged in as a normal user, the link to For Admins will be security trimmed, that is, it will simply not be visible to users other than those with Admin (Owner) permissions.

However, imagine that you want to customize the Quick Launch menu and remove the default headings, such as Lists and Libraries? You can just create the links again and due to the permissions which have already been set, the security trimming will come into play, right?

So for Owners, they will see links to both lists.

And for normal users? Oops, unfortunately security trimming has not been applied:

The security trimming has been lost along the way. Users now see links that they cannot access. Though security is in no way compromised, as ordinary users will get an Access Denied error if they click the link, this is not good design or practical from a usability point of view.

So what is the solution? In a normal SharePoint site with Quick Launch navigation, it is possible to re-establish security trimmed links, by deleting the links from the Quick Launch and then re-establishing the Quick Launch display in the settings of each list (found under Title, description and navigation of the List Settings page).

But then you will be back at square one!

The only workaround is to enable the SharePoint Server Publishing Infrastructure feature, which allows for more fine-grained management of navigation and will retain security trimming when links are re-organized.

You can then use the Navigation Settings page. But wait a minute, as the Navigation Settings page is just a standard system page on the SharePoint server and it does not actually use any of the other things that form part of the SharePoint Publishing Infrastructure, perhaps we can just call the page directly and get to use it without enabling the Publishing Infrastructure.

Try putting a link to the page somewhere on a standard site with the following syntax:

http://yourserver/yoursite/_layouts/AreaNavigationSettings.aspx

You should then be able to re-organize your navigation to your heart’s content without losing any security trimming.

SharePoint allows the overlay of up to 10 calendars to produce a kind of stacked view of events:


 

Though these may often be different calendars, there is nothing to prevent the use of several views from the same calendar in an overlay. This would normally not be useful, but there is one context in which it neatly solves a common problem. How can deadlines before events be clearly shown in a calendar? For example, for many large events such as conferences, there are deadlines for the preparation of materials and the dispatch of documents. It is possible to produce an overlay of SharePoint views from the same calendar which show these deadlines clearly.

First, create two calculated fields in the base calendar you will be using and name them Materials Deadline – 60 days and Dispatch Deadline – 30 days. In these calculated fields, use the event Start Time and subtract respectively 60 and 30 from it, as described below:

 


 

Make sure the columns are formatted as Date and Time.

Next you will need to create two calendar views which display events but which use only the Material Deadline – 60 days and the Document Dispatch – 30 days columns.

Choose your calculated fields for the Begin and End columns. Then create two overlay calendars based on the Materials and Dispatch views, as per below:

If you colour-code the two overlay views to contrast with your base calendar, then the meaning of the deadlines should be clear.

 

Be aware that if you link a Visio web drawing to a SharePoint list, there will be a five minute delay before modified data show up in the drawing, even if you refresh manually.

Yet in the underlying list the, figure for the Scooter amount has already been changed to 540:

It is therefore advisable to set an automatic refresh period of five minutes within the web part.

Like many of the list templates provided out-of-the-box, the SharePoint Survey has some useful basic functionality but the limitations quickly become apparent. A client recently asked to use the Survey list but to give users who had completed the survey some simple feedback with additional information where questions had not been answered correctly. There is no easy way to do this with the Survey list, but with a bit of customization, the following solution was developed.

This approach takes the SharePoint Survey list and moves it one step closer to being a Quiz.

Create a new view in the Survey list using SharePoint Designer

Once you have created your survey and populated it with questions you will need to create an additional view in your Survey list using SharePoint Designer. In the case of our customization, all questions were to be answered with Yes or No, so judging if the users had responded correctly was straightforward.

The view we require is one which filters on the Author field, which needs to be set to [Me]. In this way the view will provide information only from the response to the survey of the current user. In addition, the view will need to contain the answers to all the questions in the Survey.

Create a Custom List which will contain correct answers to Survey questions

Create a custom list with a column for the Survey name and columns for each Question and the further explanation of the correct answer if the answer provided in the Survey response was incorrect. In addition, you will need in this case a numeric column for each question which will contain the code for the correct answer, 1 for Yes and 0 for No.

Once this list has been created, we will customize the display form for the list using InfoPath Designer.

You will need to add another data connection to the form, apart from the Main one from the list. This data connection will by an XML connection to the new view created in the Survey list above. In order to create the connection, you will need the GUID for both the list and the view. (Both can be found when editing the view in SharePoint Designer).

Here is an example of the XML data connection from my test server:

http://win-sqpsjc4uhjv/sites/survey/_vti_bin/owssvr.dll?Cmd=Display&List=96BCAE05-CF9B-4C24-B727-C1E2970DE95D&View=C487ECC1-706B-4342-AD65-C8562CBB07CE&XMLDATA=TRUE&noredirect=true

You will need to replace the server and site names in your path, as well as the GUIDs from your list and view.

Set this data connection up as a Secondary connection in InfoPath for the Custom list form.

You are then free to organize the form as you wish. What I chose to do was align questions and additional information to be provided when the answer was incorrect and to use a rule in InfoPath to hide the answer if correct. The one tricky part is the need to have a field within the Main data connection which picks up the answer from each question, which can in turn be compared with the value for the correct answer in the custom list. Basically, the rule hides the additional explanation from the user is the answer was correct.

SharePoint 2010’s Ribbon offers some pre-set styles and mark-up styles for use when editing text. How these styles display is impacted by the Theme which is used. When customizing a theme, be aware of the following relationships:

 

Text/Background Dark 1 = normal text

Text/Background Dark 2 = Mark-up Styles, Headings 1-4 (the default is a dark blue colour of the default top band in SharePoint 2010)

 

Accent 1 = Colour Heading 1

Accent 2 = Colour Heading 2

Accent 3 = Colour Heading 3 and Caption style

Accent 4 = no effect

Accent 5 = Colour Heading 4 and Comment

Accent 6 = Highlight

 

If you look at the folder structure of a standard, out-of-the-box SharePoint site which has not been themed in any way, you will see the following structure, when opened with SharePoint Designer:

Once you customize an existing theme, a new entry will be created in the Themes Gallery, called Themed:

And within this, a folder grouping all the images and CSS files which are used within a custom theme:

Some important aspects of how your site looks can be easily changed by modifying an aspect of a theme. For example, a SharePoint theme allows the colour of hyperlinks used within the content area of pages to be changed. However, if you want to modify the behaviour of links when hovering with a mouse pointer, then this can only be done in the corev4.css file, a copy of which is saved in the Theme Gallery once a theme is customized. So to give a concrete example, if you want link text to be dark blue with no underline and to change to orange when you hover over the link, you would need to do the following:

  1. Customize your theme with the required link colour and followed link colour.
  2. Edit the COREV4.CSS file in the Theme Gallery. The file will be created with a reference number, in this case it was 8A0ABD2F, so the CSS file is called COREV48A0ABD2F.CSS. Search for ms-rtestate and change text-decoration to none and add a colour for the hover as follows:

    .ms-rtestate-field a:hover

    {

    color:orange;

    text-decoration:none;

    }

  3. Save the file and refresh your page to see the results.

Be aware that if you further change the Custom theme in any way, the COREV4.CSS will be copied again to the Theme Gallery, so you will have to redo any changes to the CSS file.