Wednesday, May 27, 2015

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

This solved my error on Windows Server 2012, IIS 8.5. Should work for other versions too.
  1. Go to Server Manager, click add Roles and Features
  2. In the roles section choose: Web Server
  3. Under Security sub-section choose everything (I excluded digest, IP restrictions and URL authorization as we don't use them)
  4. Under Application Development choose .NET Extensibility 4.5 and ASP>NET 4.5, both ISAPI entries
  5. In the Features section choose: NET 3.5.NET 4.5ASP.NET 4.5
  6. In the Web server section choose: Web Server (all)Management Tools (IIS Management Console and Management Service)Windows
follow below url

http://serverfault.com/questions/360438/iis-complains-about-a-locked-section-how-can-i-find-out-where-its-locked

Tuesday, October 29, 2013

SharePoint 2010 Search Refinement Panel in OssSearchResults.aspx page

In this post you can see how to create a Custom Section (for ex: 'ContentTypeRefiner') in the SharePoint 2010 search refinement panel.

I have seen many posts everyone saying that create a custom search page and add refinement web part. But in this example I am using out of box OssSearchResults.aspx (located under 14 hive layouts folder). Before modifying this page take a backup of this file.



You can see below webpart code in the  OssSearchResults.aspx page.

when you use below tag by default it shows below sections
Restult Type
Site
Author
Modified Date

Managed Metadata (if you have)

<SearchWC:RefinementWebPart runat="server" FrameType="None" UseDefaultConfiguration="true"  ></SearchWC:RefinementWebPart>

If you want to add any custom section then only you need to modify this web part. In my case I am adding below part.  I have created my own Managed property called 'ContentTypeRefiner'.

You can see in the below post how to create a managed property for search

<Category
    Title='ContentTypeRefiner'
    Description='Which site this document is from'
    Type='Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator'
    MetadataThreshold='5'
    NumberOfFiltersToDisplay='4'
    MaxNumberOfFilters='20'
    SortBy='Frequency'
    SortByForMoreFilters='Name'
    SortDirection='Descending'
    SortDirectionForMoreFilters='Ascending'
    ShowMoreLink='True'
    MappedProperty='ContentTypeRefiner'
    MoreLinkText='show more'
    LessLinkText='show fewer' />

<%--SearchWC:RefinementWebPart runat="server" FrameType="None" UseDefaultConfiguration="true"  --%>

Just comment existing SearchWC:RefinementWebPart code and replace with below code. Then you can see custom section in the panel.

Please keep in mind below tag should be in one line. Otherwise you can see the errors when you open this page in visual studio.

<SEARCHWC:RefinementWebPart runat="server" Description="This webpart helps the users to refine search results"  UseDefaultConfiguration="false"
       FilterCategoriesDefinition="<?xml version='1.0' encoding='utf-8'?> <FilterCategories>   <Category     Title='Result Type'     Description='The file extension of the item'     Type='Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator'     MetadataThreshold='5'     NumberOfFiltersToDisplay='4'     MaxNumberOfFilters='0'     SortBy='Frequency'     SortDirection='Descending'     SortByForMoreFilters='Name'     SortDirectionForMoreFilters='Ascending'     ShowMoreLink='True'     MappedProperty='FileExtension'     MoreLinkText='show more'     LessLinkText='show fewer'>     <CustomFilters MappingType='ValueMapping' DataType='String' ValueReference='Absolute' ShowAllInMore='False'>       <CustomFilter CustomValue='Adobe PDF'>         <OriginalValue>pdf</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Email'>         <OriginalValue>eml</OriginalValue>         <OriginalValue>msg</OriginalValue>         <OriginalValue>exch</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Excel'>         <OriginalValue>odc</OriginalValue>         <OriginalValue>ods</OriginalValue>         <OriginalValue>xls</OriginalValue>         <OriginalValue>xlsb</OriginalValue>         <OriginalValue>xlsm</OriginalValue>         <OriginalValue>xlsx</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Image'>         <OriginalValue>tif</OriginalValue>         <OriginalValue>tiff</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Lotus Notes'>         <OriginalValue>nsf</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='OneNote'>         <OriginalValue>one</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='PowerPoint'>         <OriginalValue>odp</OriginalValue>         <OriginalValue>ppt</OriginalValue>         <OriginalValue>pptm</OriginalValue>         <OriginalValue>pptx</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Publisher'>         <OriginalValue>pub</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Text'>         <OriginalValue>odt</OriginalValue>         <OriginalValue>txt</OriginalValue>         <OriginalValue>url</OriginalValue>         <OriginalValue>csv</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Visio'>         <OriginalValue>vdw</OriginalValue>         <OriginalValue>vdx</OriginalValue>         <OriginalValue>vsd</OriginalValue>         <OriginalValue>vss</OriginalValue>         <OriginalValue>vst</OriginalValue>         <OriginalValue>vsx</OriginalValue>         <OriginalValue>vtx</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Webpage'>         <OriginalValue>ascx</OriginalValue>         <OriginalValue>asp</OriginalValue>         <OriginalValue>aspx</OriginalValue>         <OriginalValue>htm</OriginalValue>         <OriginalValue>html</OriginalValue>         <OriginalValue>jhtml</OriginalValue>         <OriginalValue>js</OriginalValue>         <OriginalValue>mht</OriginalValue>         <OriginalValue>mhtml</OriginalValue>         <OriginalValue>mspx</OriginalValue>         <OriginalValue>php</OriginalValue>         <OriginalValue></OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='XML'>         <OriginalValue>xml</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Word'>         <OriginalValue>doc</OriginalValue>         <OriginalValue>docm</OriginalValue>         <OriginalValue>docx</OriginalValue>         <OriginalValue>dot</OriginalValue>         <OriginalValue>nws</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Zip'>         <OriginalValue>zip</OriginalValue>       </CustomFilter>     </CustomFilters>   </Category>    <Category     Title='Site'     Description='Which site this document is from'     Type='Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator'     MetadataThreshold='5'     NumberOfFiltersToDisplay='4'     MaxNumberOfFilters='20'     SortBy='Frequency'     SortByForMoreFilters='Name'     SortDirection='Descending'     SortDirectionForMoreFilters='Ascending'     ShowMoreLink='True'     MappedProperty='SiteName'     MoreLinkText='show more'     LessLinkText='show fewer' />   <Category     Title='ContentTypeRefiner'     Description='Which site this document is from'     Type='Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator'     MetadataThreshold='5'     NumberOfFiltersToDisplay='4'     MaxNumberOfFilters='20'     SortBy='Frequency'     SortByForMoreFilters='Name'     SortDirection='Descending'     SortDirectionForMoreFilters='Ascending'     ShowMoreLink='True'     MappedProperty='ContentTypeRefiner'     MoreLinkText='show more'     LessLinkText='show fewer' />           <Category     Title='Author'     Description='Use this filter to restrict results authored by a specific author'     Type='Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator'     MetadataThreshold='5'     NumberOfFiltersToDisplay='4'     MaxNumberOfFilters='20'     SortBy='Frequency'     SortByForMoreFilters='Name'     SortDirection='Descending'     SortDirectionForMoreFilters='Ascending'     ShowMoreLink='True'     MappedProperty='Author'     MoreLinkText='show more'     LessLinkText='show fewer'     />    <Category     Title='Modified Date'     Description='When the item was last updated'     Type='Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator'     MetadataThreshold='5'     NumberOfFiltersToDisplay='6'     MaxNumberOfFilters='0'     SortBy='Custom'     ShowMoreLink='True'     MappedProperty='Write'     MoreLinkText='show more'     LessLinkText='show fewer' >     <CustomFilters MappingType='RangeMapping' DataType='Date' ValueReference='Relative' ShowAllInMore='False'>       <CustomFilter CustomValue='Past 24 Hours'>         <OriginalValue>-1..</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Past Week'>         <OriginalValue>-7..</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Past Month'>         <OriginalValue>-30..</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Past Six Months'>         <OriginalValue>-183..</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Past Year'>         <OriginalValue>-365..</OriginalValue>       </CustomFilter>       <CustomFilter CustomValue='Earlier'>         <OriginalValue>..-365</OriginalValue>       </CustomFilter>     </CustomFilters>   </Category>   <Category     Title='Managed Metadata Columns'     Description='Managed metadata of the documents'     Type='Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator'     MetadataThreshold='3'     NumberOfFiltersToDisplay='3'     MaxNumberOfFilters='20'     ShowMoreLink='True'     MappedProperty='ows_MetadataFacetInfo'     MoreLinkText='show more'     LessLinkText='show fewer' />    <Category     Title='Tags'     Description='All managed metadata of the documents and social tags'     Type='Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator'     MetadataThreshold='3'     NumberOfFiltersToDisplay='3'     MaxNumberOfFilters='20'     ShowMoreLink='True'     MappedProperty='ows_MetadataFacetInfo,popularsocialtags'     MoreLinkText='show more'     LessLinkText='show fewer' />    </FilterCategories>"        
       />                       

Tuesday, October 1, 2013

The term is not valid term SharePoint 2010 Managed Metadata

For example when you restore your SharePoint site to development environment from production, you should restore managed metadata service database as well. Then only metadata works fine and it will synchronize with SharePoint site database.

Update Managed Metadata service database (to fix invalid term set)


1. Take a backup of production managed metadata service database
2. Restore to your development server or where ever you are working
3. Go to central admin site, create a new managed metadata service or update existing metadata service database name field with your recently restored database name.
4. If you have created a new metadata service, you have to check the checkbox of that newly created service to the web application.

Central Administration>Application Management>Service Applications>Manage service applications
>select Managed Metadata Service> select Properties from ribbon


Update "database name" field as shown in  screenshot



Associate newly restored managed metadata service database here.

if you have created a new service then you have to associate a service to the web app.



Last step:

Run the metadata service related jobs for immediate effect or you can see next day morning with out any  invalid term set errors.

you have to go to each document library and configure terms one more time.


related post
http://suryapulipati.blogspot.com/2013/10/the-sharepoint-item-being-crawled.html


The SharePoint item being crawled returned an error when requesting data from the web service. (Error from SharePoint site: *** Index was outside the bounds of the array.)

We have below errors when we run the search crawl in the SharePoint 2010 farm.

1) The SharePoint item being crawled returned an error when requesting data from the web service. (Error from SharePoint site: *** Index was outside the bounds of the array.)
2) The object was not found.
3) The server is unavailable and could not be accessed. The server is probably disconnected from the network.
4) This item could not be crawled because the repository did not respond within the specified timeout period. Try to crawl the repository at a later time, or increase the timeout value on the Proxy and Timeout page in search administration. You might also want to crawl this repository during off-peak usage times.
5) The docfile has been corrupted
6) There is more than one match for your term. Please disambiguate which term you would like to use.
7) The SharePoint item being crawled returned an error when requesting data from the web service. ( Error from SharePoint site: *** Root element is missing. )

We have fixed all issues by following below steps which are recommended by Microsoft

1. Take a snapshot of SharePoint Servers and SQL servers.
2. Take back up of all the content databases.
3. Download OCT CU 2011 (http://support.microsoft.com/kb/2596505 )
4. Install this CU On SharePoint Server.
5. Run SharePoint Products & Configuration Wizard.
6. Once completed Run the full crawl.


Still if you see the errors you might have some problem with your managed metadata.



For example when you restore your SharePoint site to development environment from production, you should restore managed metadata service database as well. Then only metadata works fine and it will synchronize with SharePoint site database.

Update Managed Metadata service database (to fix invalid term set)

1) Take a backup of production managed metadata service database
2) Restore to your development server or where ever you are working
3) Go to central admin site, create a new managed metadata service or update existing metadata service database name field with your recently restored database name.
4) If you have created a new metadata service, you have to check the checkbox of that newly created service to the web application.


Central Administration>Application Management>Service Applications>Manage service applications
>select Managed Metadata Service> select Properties from ribbon

Update your “database name” (the one recently you have taken backup and restored from production) field as shown in screenshot



Monday, September 30, 2013

An exception occurred when trying to issue security token: Method is only supported if the user name parameter matches the user name in the current Windows Identity SharePoint 2010 FBA

You will see this error when you are using windowstokenroleprovider
<add applicationName="/" name="MyRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Change to sql role provider in your web.config file. check your central admin and

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken\web.config 
 files as well.



<add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="MyRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Wednesday, August 21, 2013

Query SharePoint Choice Field List Items using CAML

Below script gets list items where 'Address Type' not equal to ‘Home Address’ of choice field

Start-SPAssignment
-Global
$url = "YoursiteURL"
$web = get-spweb $url

$list=$web.Lists["EmployeeDocuments"]
Write-Host $list.title
$i=1

$spQuery = New-Object Microsoft.SharePoint.SPQuery
$camlQuery ="<Where><Neq><FieldRef Name='Address_x0020_Type'/><Value Type='Choice'>Home Address</Value></Neq></Where>"
$spQuery.Query = $camlQuery
$spQuery.ViewAttributes = "Scope=Recursive";
$spListItems = $list.GetItems($spQuery)
     
Write-Host "count" $spListItems.count
     
#    foreach ($item in $spListItems)
#           {
#                 write-host $i  $item["Address Type"]
#                
#                 $i++
#           }


 Stop-SPAssignment -Global



Friday, August 16, 2013

Create SharePoint Choice Field (Site Column) using PowerShell

Start-SPAssignment -Global
$url = "siteurl"
$web = get-spweb $url

$fieldName = "Surya"
$field = $web.Fields[$fieldName]

 if($field -ne $nul)
 {
      Write-Host $field.Title "Field already avilable in the site"
 }
 else
 {

#There are 2 ways to create a field.
#First Apporach
 <#
      Write-Host "no fields exist with this name. creating..."
      $web.fields.add($fieldName, "Choice", $true)
      $field = $web.fields.getfield($fieldName)
      $field.Group = "Custom Columns"
      $field.Choices.Add("Yes")
      $field.Choices.Add("No")
      $field.Update()
     Write-Host "Field Created"
#>

#Second Apporach

      $suryafield = "<Field Type='Choice' DisplayName='Surya' Required='TRUE' Format='Dropdown' Group='Custom Columns'
      FillInChoice='FALSE' StaticName='Surya' Name='Surya'>
            <CHOICES>
                <CHOICE>YES</CHOICE>
                <CHOICE>NO</CHOICE>
            </CHOICES>
           </Field>"
      $web.Fields.AddFieldAsXml($suryafield)
  Write-Host "Field Created"
 }

 Stop-SPAssignment -Global


Followers