Showing posts with label Hidden. Show all posts
Showing posts with label Hidden. Show all posts

Wednesday, April 25, 2012

SharePoint SPWeb Property ParserEnabled

ParserEnabled property controls demotion and promotion.
Promotion refers to the process of extracting values from properties of a document and writing those values to corresponding columns on the list or document library where the document is stored.
Demotion is the same process in reverse. Values are read from list columns and written to document properties.
When ParserEnabled property false there will not be any property demotion and promotion. it means metadata and document file properties will not be in sync.

Disabling and enabling this property using PowerShell:
To disable this property:

    [system.reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $site = new-object Microsoft.SharePoint.SPSite("http://mossweb/sites/test")
    $site.RootWeb.ParserEnabled = $false
    $site.RootWeb.Update()

To enable document property promotion:

    $site.RootWeb.ParserEnabled = $true
    $site.RootWeb.Update()

Note:
Disabling ParserEnabled affect:
  1. We can't search in document library using Office document properties.
  2. When you upload image file. Thumbnail will not be generated.
  3. When you save a list template, You will not see it in list template gallery.

If you need to disable this property you need to take care of its effect. Disable it only in special sites. if you want it when you upload document using code disable it temporary using code like below:

using (var site = new SPSite("http://portal"))

using (var web = site.OpenWeb())
{
   SPFile file = web.GetFolder("Documents").Files["mydoc.docx"]; 
   using (var fs = new FileInfo(@"E:\Documents\mydoc.docx").OpenRead())

   {
    documentBytes = ..... // get the documents bytes
   }
   web.ParserEnabled = false;
   web.Update();
   file.SaveBinary(documentBytes);
   web.ParserEnabled = true;  
   web.Update();
}



Sunday, January 23, 2011

Unable to modify navigation - Add heading/link

When I Try to modify Navigation in a site and add a heading, this is not working. When pushing OK, there is nor error messages appearing, but the heading is not showing up.
Problem missed navbar nodes of the onet.xml in custom site template.
  • Solution add NavBar nodes to onet.xml:<navbars>
    <navbar name="SharePoint Top Navbar" id="1002">
    </navbar>
    </navbars>
  • Wrote an SQL query to update the broken sites. T-Sql to execute in contentdbINSERT INTO [NavNodes] ([SiteId] ,[WebId] ,[Eid] ,[EidParent] ,[NumChildren] ,[RankChild] ,[ElementType] ,[Url] ,[DocId] ,[Name] ,[DateLastModified] ,[NodeMetainfo] , NonNavPage] ,[NavSequence] ,[ChildOfSequence])
    SELECT DISTINCT SiteId, WebId ,1002 ,0 ,0 ,1 ,1 ,'' ,NULL ,'SharePoint Top Navbar' ,getdate() ,NULL ,0 ,1 ,0
    FROM NavNodes
    WHERE WebId NOT IN (
    SELECT WebId
    FROM NavNodes
    WHERE Eid = 1002)
  • The query adds the SharePoint Top Navbar node to the NavNodes tables where a web does not already have one.