Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

Archive for the ‘SharePoint Designer’ Category

Hiding the Search Box When Printing

leave a comment »

Ever noticed that the search box is shown on a SharePoint page when printed while other parts of the page are hidden?

HidePrint1

The Search box can be hidden, along with other parts of a form you don’t want printed by using styles. This can be done using Microsoft Office SharePoint Designer:

  • Open the master page in SharePoint Designer
  • Add the following style either to a CSS file included in the master page or as a style within the master page itself:

@media print{
.HideForPrinting
{
display:none;
}
}

  • Locate the delegate control used to display the search box and add the code shown in italics:

    <asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server”>
    <span class=”HideForPrinting”>
    <SharePoint:DelegateControl runat=”server” ControlId=”SmallSearchInputBox”/>
    </span>
    </asp:ContentPlaceHolder>

This defines a span that uses the style HideForPriting, the content of which will be hidden when the page is printed.

Advertisements

Written by Nick Grattan

October 1, 2008 at 8:07 pm

Changing Page Used to Display Items in a List

with one comment

When displaying a view on a list (such as displayed with “AllItems.aspx”) the “Title” hyperlink for an item will redirect you, by default, to the “DispForm.aspx” page with the ID passed as a query parameter.

Link1

There are times when you may need to change the page used in the link, for example:

  • When you have your own custom page for displaying an item.
  • You want the take the user directly to editing an item rather than displaying an item.

The default page can be changed using SharePoint designer. To do this:

  • Run SharePoint Designer and open up the site in which the list resides.
  • Right click the list and select Properties.
  • Select the Supporting Files tab.

Link2

  • Ensure to select the correct “Content Type”, e.g. “Items” – note that in the above case it defaults to “Folder”.

From this dialog, you can use the appropriate Browse button to select the file to use for the “Display”, “New” or “Edit” operation.

NOTE: The URL shown in the browser (see first figure) will still show “DispForm.aspx” but clicking the link for an item will navigate correctly to the page you select.

 

 

Written by Nick Grattan

May 29, 2008 at 8:42 am

Bulk Editing of SharePoint List Items

with 5 comments

Imagine you have a list with a “Confirm” yes/No field and you want a user to be able to view items and click a Check box on those items which are completed and click a Save button:

Bulkedit1

This saves the user opening each item in turn, changing the “Confirm” field and saving the item. This can be done using the SharePoint Designer and using a DataView. To do this:

  • Select File + New + Page to create a new ASPX page.
  • Choose “Create from Master Page…” and click OK and OK again to use the default master page..
  • Save the page as “BulkEdit.aspx” in the list’s folder, e.g. “ConfirmList” where the existing AllItems.aspx file exists.
  • “Create Custom Content” for “PlaceHolderMain” using the quick link:

Bulkedit2

  • Open the “Data Source Library” pane and click the list, e.g. “ConfirmList” and select Show Data:

Bulkedit3

  • Select the Insert Selected Fields as… button in the Data Source Details panel and select Multiple Item Form:

Bulkedit4

  • From the “Common Data View Tasks” menu select Edit Columns and remove all columns bar “Title” and “Confirm” (or whatever columns you want displayed).

You will now set the “Title” column to be read-only so that only the “Confirm” check box is editable.

  • Single click a “Title” edit box and click the “Common FormField Tasks” button (the greater than sign) and select “Text” from the “Format as” list.
  • Save the file.
  • To test, navigate to the page, e.g. TestSite/Lists/ConfirmList/bulkedit.aspx.

Also take a look at http://office.microsoft.com/en-us/sharepointdesigner/HA101191141033.aspx, this uses an XML file as the data source rather than a SharePoint list.

Written by Nick Grattan

May 13, 2008 at 12:13 pm

Changing the Task list for SharePoint Designer Workflows

with 15 comments

By default, SharePoint designer will automatically select an existing Task list or create a new one if a suitable Task list does not exist. To change the Task list being used:

  1. Create a new Task list using Site Actions + Create.
  2. Find the Id (Guid) for this new list following the technique described in my blog entry here.
  3. Using SharePoint Designer, open the site where the workflow exists, expand out the “Workflows” folder and the workflow whose Task list is to be changed.
  4. Locate the file called workflowname.xoml.wfconfig.xml and open this file for editing.
  5. Take the Id found in (2) above and replace the Id in the “<Association>” element’s “TaskListID” attribute.
  6. Save the file.

 

Written by Nick Grattan

April 29, 2008 at 11:32 am

Finding the Id (Guid) for a SharePoint List

with 47 comments

There are times when you need to find the Id (a Guid) of a list – for example, when setting the Task list to be used with SharePoint Designer Workflows (see my blog post here). Here’s a simple way of doing this:

  • Navigate to the SharePoint list using the browser.
  • Select the Settings + List Settings menu command.
  • Copy the Url from the browser address bar into Notepad. It will look something like:

http://moss2007/ProjectX/_layouts/listedit.aspx?List=%7B26534EF9%2DAB3A%2D46E0%2DAE56%2DEFF168BE562F%7D

  • Delete everying before and including “List=”.
  • Change “%7B” to “{”
  • Change all “%2D” to “-“
  • Chnage “%7D” to “}”

You are now left with the Id:

{26534EF9-AB3A-46E0-AE56-EFF168BE562F}

Update: See Ken’s Comment for a simpler solution (thanks!):

A (slightly) easier way if you have MOSS 2007 is to go to the List or Library settings as described above, then right-click on the “Audience targeting settings” or “Information management policy settings” links and choose Copy Shortcut.

You can then paste the URL and there’s no need to decode the GUID. For some reason these links aren’t URL encoded.

Update: These techniques work for SharePoint 2010 Standard/Enterprise editions as well. Using Ken’s tip does not work for SharePoint 2010 Foundation as these list settings options are not available so you’ll need to use my first suggestion in this case.

Update: And it works for SharePoint 2013 too!

Written by Nick Grattan

April 29, 2008 at 11:10 am

Microsoft SharePoint Designer Workflows – Things is doesn’t do

with 11 comments

Creating workflows with the Microsoft SharePoint Designer is quick and simple. However, there are number of distinct limitations which you need to be aware of, such as:

  • Workflows have no looping or flow control statements. Workflows execute serially from the top to the bottom. Implementing flows such as “continue executing until approval is made” becomes problematic.

Update 25 Nov 2009: See this post for how while loops can be simulated using stateful workflows with Microsoft SharePoint Designer.

  • Workflows can only be associated with lists, not content types. This can be limiting when you allow, for example, users to select one of a number of InfoPath forms on the “New” menu and you want different workflows depending on the type of document created.

Update 25 Nov 2009: You will have to wait until SharePoint Designer 2010 and SharePoint 2010 for this!

  • Workflows are associated with a single list. You can, though, using the technique described here copy them to other lists.

This list doesn’t include limitations in the standard actions provided by Microsoft SharePoint designer – custom actions written in Visual Studio can help in this case.

Written by Nick Grattan

April 14, 2008 at 3:08 pm

Using the XmlFormView Web Part with InfoPath Forms

with 33 comments

In this earlier post I briefly describe how to embed an InfoPath form in a SharePoint Web Part Page using the XmlFormView web part. I’ve been asked on many occasions to provide a more detailed account.

You can find the step-by-step guide to embedding an InfoPath form in an XmlFormView web part in a white paper here: How to Host Microsoft InfoPath Forms in SharePoint Pages. This document also shows how to create a Submit button to override the normal “Save” option on InfoPath forms.

Updated September 2009: Now includes instructions on creating a web part page using Microsoft SharePoint Designer for XmlFormView web parts. This is much easier than using the browser.

Written by Nick Grattan

December 19, 2007 at 1:31 pm