Skip to main content

Features

Go Search
Home
Blog
Content By Type
Alpe d'Huzes
SharePoint Objects
  

Other Blogs
There are no items in this list.
Ton Stegeman > Content By Type > Features > Posts > Configuration stores names instead of IDs
Configuration stores names instead of IDs

In version 1.2 of the ContentByType webpart, the XML configuration stored on the webpart properties holds the internal field names of fields and the name of the selected content type. In the previous version, the ID's (Guids and ContentTypeIDs) were saved. This made it impossible to export the webpart and re-use it in another site collection. Now you can do that. And because it stored the internal field names, it also works well if you are using variations.

Another thing you can do because of this new feature is add the webpart definition to your site definitions and/or page layouts.

A quick example. First I configured my webpart to display content like this:

names1

The configuration that is stored on the webpart properties looks like the snippet below. In this snippet you will see fieldnames instead of guids. The fieldnames and the name of the selected content type are marked green.

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<DatasourceConfiguration 
 xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
 xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
  <DatasourceID>contenttype</DatasourceID>
  <GroupBy>Priority</GroupBy>
  <ItemMenu>LinkUrl</ItemMenu>
  <SortBy>TaskStatus</SortBy>
  <SortOrder>desc</SortOrder>
  <PageSize>0</PageSize>
  <MaximumItems>0</MaximumItems>
  <PagerMode>NumericButtons</PagerMode>
  <PagerPosition>Bottom</PagerPosition>
  <PageButtonCount>0</PageButtonCount>
  <GridType>SharePointGrid</GridType>
  <JustSearchOnQuery>false</JustSearchOnQuery>
  <OpenAllLinksInNewWindows>false</OpenAllLinksInNewWindows>
  <CustomProperties>
    <CustomProperty>
      <Value>MyTask</Value>
      <Id>contenttype</Id>
    </CustomProperty>
    <CustomProperty>
      <Value>false</Value>
      <Id>includedescending</Id>
    </CustomProperty>
    <CustomProperty>
      <Value>-1</Value>
      <Id>listservertemplate</Id>
    </CustomProperty>
  </CustomProperties>
  <Filters />
  <FieldReferences>
    <FieldReference>
      <OpenInNewWindow>false</OpenInNewWindow>
      <Id>Title</Id>
    </FieldReference>
    <FieldReference>
      <LinkFieldId>AssignedTo_Url</LinkFieldId>
      <OpenInNewWindow>false</OpenInNewWindow>
      <Id>AssignedTo</Id>
    </FieldReference>
    <FieldReference>
      <OpenInNewWindow>false</OpenInNewWindow>
      <Id>StartDate</Id>
    </FieldReference>
    <FieldReference>
      <OpenInNewWindow>false</OpenInNewWindow>
      <Id>TaskStatus</Id>
    </FieldReference>
  </FieldReferences>
</DatasourceConfiguration>

Comments

There are no comments yet for this post.