About Me

A career professional with 19 years of experiences with in application development, solution architecture, management and strategy. Architected, planned, and executed, many programs, projects and solutions delivering valued results to business clients and customers. Able to provide creative solutions to solve problems and articulate the value proposition to upper management and technical design to IT staff. Collaborates across teams and other facet of IT (i.e. operations, infrastructure, security) to validate solutions for completeness. Interface with clients to gather feedback, advise, and solution in the business language.

Wednesday, January 27, 2010

Enabling and disabling property promotion

Recently while doing a project we have to migration document from a disk to SharePoint. We didn't have budget to buy a tool for the migration so we had to go it alone. We wrote our own tool but during the migration we ran into one problem. The metadata properties on the office documents where coming in wrong.

XYZ.doc (We wanted the title = 'Test Document') when this document was migrated it would show up like XYZ.doc title = 'ABC Document' .

After a little digging we discovered it was the property promotion of SharePoint.

I came across some powershell script and here's my version ...

param($url=$(Throw "Parameter missing: -url"), $switch=$(Throw "Parameter missing (on/off): -switch"))
"URL -> $url, swith-> $switch"
$site = New-Object Microsoft.SharePoint.SPSite($url)

$enabled = $true
if ($switch -match "off") {$enabled=$false};
"Current Setting;"+$site.RootWeb.ParserEnabled;
$site.RootWeb.ParserEnabled = $enabled
"After Setting;"+$site.RootWeb.ParserEnabled;

"Current Setting;"+$site.ParserEnabled;
#$site.ParserEnabled = $enabled
#"After Setting;"+$site.ParserEnabled;

foreach ($web in $site.AllWebs)
"Current Setting;"+$web.ParserEnabled;
$web.ParserEnabled = $enabled;
$web.Url +"["+$web.ParserEnabled+"]";
"After Setting;"+$web.ParserEnabled;