1

I am working on a custom page layout where I need to add a Content By Search web part in a Web Part zone but I am unable to do so.

The following is my code:

<WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager"></WebPartPages:SPProxyWebPartManager>
<WebPartPages:WebPartZone runat="server" title="Zone 1" ID="FirstZone" AllowPersonalization="False" AllowCustomization="False" AllowLayoutChange="False"><ZoneTemplate>


  <spsswc:ContentBySearchWebPart runat="server" AlwaysRenderOnServer="False" ResultType="" NumberOfItems="5" ShouldHideControlWhenEmpty="False" DataProviderJSON="{&quot;SourceID&quot;:&quot;94af56ee-2b04-4331-af03-905d39db71fb&quot;,&quot;SourceName&quot;:&quot;Service News Webpart&quot;,&quot;QueryTemplate&quot;:&quot;*&quot;,&quot;ClientType&quot;:&quot;ContentSearchRegular&quot;,&quot;QueryGroupName&quot;:&quot;Default&quot;,&quot;QueryPropertiesTemplateUrl&quot;:&quot;sitesearch://webroot&quot;,&quot;IgnoreQueryPropertiesTemplateUrl&quot;:false,&quot;SourceLevel&quot;:&quot;SPSite&quot;,&quot;CollapseSpecification&quot;:&quot;&quot;,&quot;FallbackSort&quot;:[{&quot;p&quot;:&quot;RefinableDate00&quot;,&quot;d&quot;:1}],&quot;FallbackSortJson&quot;:&quot;[{\&quot;p\&quot;:\&quot;RefinableDate00\&quot;,\&quot;d\&quot;:1}]&quot;,&quot;RankRules&quot;:null,&quot;RankRulesJson&quot;:&quot;null&quot;,&quot;AsynchronousResultRetrieval&quot;:false,&quot;SendContentBeforeQuery&quot;:true,&quot;BatchClientQuery&quot;:true,&quot;FallbackLanguage&quot;:-1,&quot;FallbackRankingModelID&quot;:&quot;&quot;,&quot;EnableStemming&quot;:true,&quot;EnablePhonetic&quot;:false,&quot;EnableNicknames&quot;:false,&quot;EnableInterleaving&quot;:false,&quot;EnableQueryRules&quot;:true,&quot;EnableOrderingHitHighlightedProperty&quot;:false,&quot;HitHighlightedMultivaluePropertyLimit&quot;:-1,&quot;IgnoreContextualScope&quot;:true,&quot;ScopeResultsToCurrentSite&quot;:false,&quot;TrimDuplicates&quot;:false,&quot;Properties&quot;:{&quot;TryCache&quot;:true,&quot;Scope&quot;:&quot;{Site.URL}&quot;,&quot;UpdateLinksForCatalogItems&quot;:true,&quot;EnableStacking&quot;:true,&quot;ListId&quot;:&quot;00000000-0000-0000-0000-000000000000&quot;},&quot;PropertiesJson&quot;:&quot;{\&quot;TryCache\&quot;:true,\&quot;Scope\&quot;:\&quot;{Site.URL}\&quot;,\&quot;UpdateLinksForCatalogItems\&quot;:true,\&quot;EnableStacking\&quot;:true,\&quot;ListId\&quot;:\&quot;00000000-0000-0000-0000-000000000000\&quot;}&quot;,&quot;UpdateAjaxNavigate&quot;:true,&quot;SummaryLength&quot;:180,&quot;DesiredSnippetLength&quot;:90,&quot;PersonalizedQuery&quot;:false,&quot;FallbackRefinementFilters&quot;:null,&quot;IgnoreStaleServerQuery&quot;:false,&quot;RenderTemplateId&quot;:&quot;DefaultDataProvider&quot;,&quot;AlternateErrorMessage&quot;:null,&quot;Title&quot;:&quot;&quot;}" BypassResultTypes="True" ItemTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/SFW_ServiceNewsWP_Content_Item.js" GroupTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Group_Content.js" ResultsPerPage="5" SelectedPropertiesJson="[&quot;Title&quot;,&quot;Path&quot;,&quot;Description&quot;,&quot;EditorOWSUSER&quot;,&quot;LastModifiedTime&quot;,&quot;CollapsingStatus&quot;,&quot;DocId&quot;,&quot;HitHighlightedSummary&quot;,&quot;HitHighlightedProperties&quot;,&quot;FileExtension&quot;,&quot;ViewsLifeTime&quot;,&quot;ParentLink&quot;,&quot;FileType&quot;,&quot;IsContainer&quot;,&quot;SecondaryFileExtension&quot;,&quot;DisplayAuthor&quot;,&quot;NewsPageSummary&quot;,&quot;NewsPageRollupImage&quot;,&quot;NewsArticlePageDate&quot;,&quot;NewsPageImage&quot;]" HitHighlightedPropertiesJson="[&quot;Title&quot;,&quot;Path&quot;,&quot;Author&quot;,&quot;SectionNames&quot;,&quot;SiteDescription&quot;]" AvailableSortsJson="null" ShowBestBets="False" ShowPersonalFavorites="False" ShowDefinitions="False" ShowDidYouMean="False" PreloadedItemTemplateIdsJson="null" QueryGroupName="Default" RenderTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/SFW_ServiceNewsWP_Content_List.js" StatesJson="{}" ServerIncludeScriptsJson="null" Title="Content Search" FrameType="None" SuppressWebPartChrome="False" Description="&lt;%$Resources:Microsoft.Office.Server.Search,CBS_Description;%&gt;" IsIncluded="True" ZoneID="ImportedPartZone" PartOrder="2" FrameState="Normal" AllowRemove="True" AllowZoneChange="True" AllowMinimize="True" AllowConnect="True" AllowEdit="True" AllowHide="True" IsVisible="True" DetailLink="" HelpLink="" HelpMode="Modeless" Dir="Default" PartImageSmall="" MissingAssembly="&lt;%$Resources:core,ImportErrorMessage;%&gt;" ImportErrorMessage="&lt;%$Resources:core,ImportErrorMessage;%&gt;" PartImageLarge="" IsIncludedFilter="" ExportControlledProperties="True" ConnectionID="00000000-0000-0000-0000-000000000000" ID="g_56553719_4340_400e_89eb_db1e9fdb54af" ChromeType="None" ExportMode="All" WebPart="true" Height="" Width="" __WebPartId="{EECC67AA-766D-40FE-B884-66818FEB2A42}" __MarkupType="xmlmarkup"></spsswc:ContentBySearchWebPart>
    </ZoneTemplate></WebPartPages:WebPartZone>

When the above mentioned code is used and a page layout is created, the page creation process gives an error as shown below:

enter image description here

Please help.

  • I'm waaaaaay too lazy to do this myself, but if I had to guess, there's some small syntax error in your JSON. You may want to pull that out and decode it, make sure you're not missing an apostrophe or a colon somewhere. – ChrisPEditor Feb 13 '16 at 15:43
  • Could you be more detailed and specific in your answer so that I am able to get you clearly and make the relevant changes. – Mancy Desaee Feb 15 '16 at 4:51
  • Oh, yeah, sure. My suggestion (not an answer, just a guess!) is to take all the stuff that's in those JSON parameters (DataProviderJSON, SelectedPropertiesJson, and HitHilightPropertiesJson) and put it in something that can easily change URL encoded characters (i.e., ;quot&) to their decoded counterparts and look for syntax errors. Missing commas, unclosed brackets, etc. – ChrisPEditor Feb 15 '16 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.