Category Archives: SharePoint 2010

The Content Type Hub and Nintex Reusable Workflows

SharePoint 2010 has a great new feature, called the Content Type Hub. With the CT Hub you can manage your Content Types in one site collection and through the Managed Metadata Service you can subscribe to this Hub with other site collections. The Content Types of your choice will be synchronized to all site collections of all the web applications connected to your Managed Metadata Service instance. Wictor Wilén has a blog post explaining how to deploy the Content Type Hub: http://www.wictorwilen.se/Post/Plan-your-SharePoint-2010-Content-Type-Hub-carefully.aspx

What you need to know is that together with the Content Types, also the corresponding Information Management Policies and the Workflow associations are synchronized, but not the Workflows themselves. I had created some reusable site workflows with Nintex Workflow 2010 and associated these with my Content Types, but after updating the subscription on one of my target site collections, I received the following error:

The workflow association <workflow name> for content type <content type name> is not imported because the workflow with id <GUID> cannot be found.

Continue reading

Using the “Upload a Document” button from the Document Center in another site

Everybody who has ever deployed a site in SharePoint 2010 based on the Document Center template, has seen the large “Upload a Document” button.

UploadDocument

When you edit the page, you can see the button is nothing more than a Content Editor Web Part (CEWP), containing some HTML to show the button. The HTML looks like this:

As a note, the &#39; and &#160; codes are HTML codes for ‘ and a space.

Now, when you want to put this button on another page in another site, to provide easy access to the Document Center for your users, there is two things you need to do. First, you need to find out the List ID of the Document Library you’d like to upload your documents to. Second, you need to add a small Javascript function to make the button work.
Continue reading

SharePoint list as source for BDC model: how to handle hyperlink and lookup columns

My dear colleague Katharina Schröder recently blogged about using a SharePoint list as a source for an external content type in SharePoint 2010. This is not possible with SharePoint Designer, so she describes how to create a BDC model in Visual Studio 2010 for this scenario. You can find her blog post here: http://kaydee-at-work.blogspot.com/2010/08/use-sharepoint-as-source-for-external.html

But how to handle hyperlink and lookup columns? Both types of column display the actual value SharePoint stores in these columns. For hyperlink columns that is web address, description and for lookup columns that is ID;#Value. The image below shows both a lookup column and a hyperlink column:

image

So, now we would like both columns clickable and for the lookup column we need to find the URL to the appropriate list item too, before we can make it clickable.

Change a column type to a hyperlink

Let’s start with the easy part: change the column type to Hyperlink or Picture instead of Single line of text. For this we need to add a custom property to the TypeDescriptor corresponding to the column we’d like to change. Microsoft has described all available custom properties for Business Data Connectivity services here: http://msdn.microsoft.com/en-us/library/ff394525.aspx. We will use the SPCustomFieldType property.

In your BDC Explorer in Visual Studio select the appropriate TypeDescriptor (WebPage in this example) and open the collection of Custom Properties from the TypeDescriptor Properties pane:

image

Adding an entry with the Property Editor is a bit of a hassle, but it should work if you follow these steps:

  1. Double-click in the Name column of the blank line. The field will be marked with a red border.
  2. Type SPCustomFieldType and hit enter.
  3. Now double-click the Value field of your entry and type URL. Now click outside your property line, click OK and the property is added.

The column is now shown nicely as a hyperlink:

image

There seems to be a caveat though. This property only works for the SpecificFinder methods and not for your Finder method. So you can only add this property to the TypeDescriptor of your ReadItem method and not your ReadList method.

Now let’s see how we can create the URL for a lookup column.

Build the URL for a lookup column

As we have seen above, the value returned for a lookup column is not a valid URL, so we cannot click that to view the list item of the lookup field. The display link of a list item can formatted as <SiteUrl>/_layouts/listform.aspx?PageType=4&ListId=<ListID>&ID=<ItemID>&RootFolder=*. So we are going to need some code to get the values for the <SiteUrl>, the <ListID> and the <ItemID> of the list item the lookup column refers to. Fortunately, the list ID and web ID of the list a lookup column refers to are stored in the column properties.

The code below first checks if a lookup column does not allow multiple values, because then the building of the URL would be more complex. Next it reads the list ID and web ID of the list the lookup column is connected to. Using these properties we can build the URL to display the actual list item the lookup column references. Finally we add the display description, seperated with a comma. Be aware that there needs to be a space between the comma and the display value, or the column value will not be recognized as a SPCustomeFieldType of the type URL.

I hope this will help you with building your own External Content Types using a SharePoint list as a source.

How to get a Document Library displayed in your Quick Launch through the Lists.asmx web service

So you have just created a Document Library (or any other SharePoint list for that matter) through the SharePoint Lists.asmx web service (AddList method: http://msdn.microsoft.com/en-us/library/lists.lists.addlist(v=office.12).aspx), and you wonder why this Document Library is not showing up in your site’s Quick Launch? Fortunately, there is the UpdateList method (http://msdn.microsoft.com/en-us/library/lists.lists.updatelist(v=office.12).aspx). But hey… there is no option to add the Document Library to the Quick Launch. Setting the Hidden attribute to TRUE does hide your Document Library from the Documents and Lists page, but setting it to FALSE only makes it show up at this same page, it doesn’t make the library show up in your Quick Launch.

It seems naughty Microsoft is not describing all attributes for the listProperties parameter of the UpdateList method on MSDN. Cause actually, a OnQuickLaunch attribute exists as well. Set this one to TRUE and your Document Library or List appears in your Quick Launch.

The entire SOAP envelope of your webservice call would look like this:

<?xml version=”1.0″ encoding=”utf-8″?>
<soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>
    <soap:Body>
        <UpdateList xmlns=”http://schemas.microsoft.com/sharepoint/soap/”>
            <listName>[Name or GUID of the list]</listName>
            <listProperties><List OnQuickLaunch=”True” /></listProperties>
            <newFields></newFields>
            <updateFields></updateFields>
            <deleteFields></deleteFields>
            <listVersion></listVersion>
        </UpdateList>
    </soap:Body>
</soap:Envelope>

This also works if you just created a SharePoint list with the Create List action from Nintex Workflow 2007, and you’d like to get that list in your Quick Launch. Use the Call Web Service action, point to <your_site>/_vti_bin/Lists.asmx, choose UpdateList as the web method, and use the SOAP envelope above as an example to create your own envelope.