Share this page

Sunday, August 29, 2010

Tool to import or export metadata property mappings of SharePoint 2007 Search Engine

I have worked in several projects with the search engine of SharePoint 2007 and one of the things that did several times was create a custom metadata properties mappings to create custom scope, extend the advanced search page and more. But the problem is not creating them in the Shared Service Provider of SharePoint, the problem was migrate them to another Shared Service Provider or farm to install a production server, I need create them again in the new environment.
Then, first create an engine to migrate the properties from a Shared Service Provider to another using a console program and a XML file. With the engine working, I could migrated the properties created in a Shared Service Provider to another. Once tested the engine I thought that would be an excellent plug-in in the central administration of SharePoint 2007, I did it.
In SharePoint 2007 we need create the metadata properties in each Shared Service provider as we can see in image 1

[Image 1]
1 Metadata Property Mappings SharePoint Engine Search

But, what happen when we have a lot of SSP in the farm or a lot of farms to configure the search and to have our properties are available? is a hard work.
With the tool we could export or import properties easier and faster between several Shared Services Providers. In the image 2 we can see the home page of the tool.

[Image 2]
2 Managed Porperties List

As we can see in the image 3, we have a control to select the Shared Service Provider in the Farm of SharePoint 2007

[Image 3]
3 Managed Porperties List Shared Listed

We must select the properties that we want export and select the link “Export” in the top of the tool as we can see in image 4

[Image 4]
4 Export Managed Properties

The next step is to save the XML file that the tool will generate with all information of the properties selected. In the section 1 we can see an example of XML file generated by the tool.

[Section 1]

  1. <ManagedProperties>
  2.   <MetadataProperty PropertyName="AboutMeTest" Type="Text" MayBeDeleted="False" UseInScope="False">
  3.     <PropertiesMappings>
  4.       <Mapping Category="People" PropertySetId="00110329-0000-0110-c000-000000111146" VariantType="31"
  5.                DataType="31" MultiValued="">urn:schemas-microsoft-com:sharepoint:portal:profile:AboutMe</Mapping>
  6.       <Mapping Category="SharePoint" PropertySetId="00130329-0000-0130-c000-000000131346" VariantType="31"
  7.                DataType="31" MultiValued="">ows_Notes</Mapping>
  8.     </PropertiesMappings>
  9.   </MetadataProperty>
  10.   <MetadataProperty PropertyName="AccountTest" Type="Text" MayBeDeleted="False" UseInScope="False">
  11.     <PropertiesMappings>
  12.       <Mapping Category="SharePoint" PropertySetId="00130329-0000-0130-c000-000000131346" VariantType="31"
  13.                DataType="31" MultiValued="">ows_Name</Mapping>
  14.     </PropertiesMappings>
  15.   </MetadataProperty>
  16.   <MetadataProperty PropertyName="AssistantTest" Type="Text" MayBeDeleted="False" UseInScope="False">
  17.     <PropertiesMappings>
  18.       <Mapping Category="People" PropertySetId="00110329-0000-0110-c000-000000111146" VariantType="31"
  19.                DataType="31" MultiValued="">urn:schemas-microsoft-com:sharepoint:portal:profile:Assistant</Mapping>
  20.     </PropertiesMappings>
  21.   </MetadataProperty>
  22. </ManagedProperties>

The file had all information of the property and the mappings created in SharePoint. We can create a XML from the scratch using a blank XML selecting the link “Downloading Sample XML” in the tool bar, as we can see in image 4.
In the image 5 we can see the import section where we are going to load the XML with the information of properties.

[Image 5]
5 Import Managed Properties

In the image 6 we can see one of the errors that the tool throws. This error is because the mappings defined in the XML file not exist in the Shared Service Provider selected. But the property will be created in the SSP without a mapping associated.

[Image 6]
6 Mappings not exists

In the image 7 we can see the error thrower by the tool when the property exists in the Shared Service Provider of SharePoint.

[Image 7]
7 Error Propoery Exist

In the image 8 we can see the message loaded by the tool when the property was imported well.

[Image 8]
8 Imported Managed Properties sucefully

To install the tool, we must do a deploy of a WSP in the site of the Central Administration of SharePoint. Once the WSP is deployed, we need active a feature in the site feature of the central administration as we can see in image 9.

[Image 9]

9 Activating Features Managed Properties

When the feature is activated in the central administration a new section was created in the “Application Management” as we can see in image 10

[Image 10]
10 Application Managment Option Created

To download the solution, you can enter to CodePlex site or my SkyDrive. In the zip file there are 2 bats to install the WSP. The installation bat only installs the WSP in SharePoint. The deploy in the site of central administration is manually.

LogoCodePlex

Skydrive

Fabián Imaz

No comments: