SharePoint 2013 – Add and Remove Link Items From Search Navigation Using PowerShell

Sunday, May 11, 2014

Here’s a quick tip on how to add link items to SharePoint 2013 search navigation and how to remove items from search navigation. Add Items: $sites=Get-SPsite http://testsite -Limit all | Get-SPweb $node1 = new-object -TypeName "Microsoft.SharePoint.Navigation.SPNavigationNode" -ArgumentList "Link1", "http://site/sites/Search/Pages/pageA.aspx", $true $node2 = new-object -TypeName "Microsoft.SharePoint.Navigation.SPNavigationNode" -ArgumentList "Link2", "http://site/sites/Search/Pages/PageB.aspx", $true $node3 = new-object -TypeName "Microsoft.SharePoint.Navigation.SPNavigationNode" -ArgumentList "Link3", "http://site/sites/Search/Pages/PageC.aspx", $true foreach ($web in $sites) { $web.Navigation.SearchNav.AddAsFirst($node1) $web.Navigation.SearchNav.AddAsFirst($node2) $web.Navigation.SearchNav.AddAsFirst($node3) } Remove items: $navItems=@(); $sites=Get-SPsite http://testsite -Limit all | Get-SPweb foreach($web in $sites){ $navs = $web.Navigation.SearchNav foreach ($nav in $navs) { $nodeid =$web.Navigation.GetNodeById($nav.Id) $idItems+=$nodeid write-host "add id...

Fast Search Pipeline Extensibility for Specific Content Source

Friday, May 17, 2013

Since the Pipeline Extensibility is not restricted to any content source and the fact that you do not have a proper API, makes it really hard to work with a specific Content Source. Luckily for us we have a Crawled Property which is mapped to the managed property "ContentSource": <CrawledProperty propertySet="012357BD-1113-171D-1F25-292BB0B0B0B0" varType="31" propertyName="315" /> So you can include this in your extensibility configuration and you can see which content source the data came from and apply appropriate logic. Example: static void Main(string args) { XDocument inputDoc = XDocument.Load(args); ...
one comment

How to Get Login Name and Display Name using SharePoint 2013 REST API

Wednesday, May 1, 2013

Working with REST API is quite simple and straight forward, for example when you need to fetch data from a list you can use the following JQuery Ajax code snippet: jQuery.ajax({ url: "http://YourSite/_api/web/lists/getbytitle('ListName')/items", type: "GET", headers: { "Accept": "application/json;odata=verbose" }, success: function(data, textStatus, xhr) { ...

SharePoint: Getting “This collection already contains an address with scheme http” Error When Creating a Custom WCF Service

Tuesday, April 23, 2013

Problem: The problem is caused by the fact that IIS supports specifying multiple IIS bindings per site (which results in multiple base addresses per scheme, in our case HTTP), but a WCF service hosted under a site allows binding to only one base address per scheme. Multiple addresses example (in our case two): Solution: Create a custom service factory to intercept and remove the additional unwanted base addresses that IIS was providing. A) Add the custom service factory to your Custom.svc file   <%@ServiceHost language=c# Debug="true" Service="MySolution.Services.CustomService, $SharePoint.Project.AssemblyFullName$" Factory="MySolution.Core.CustomHostFactory", $SharePoint.Project.AssemblyFullName$ %> * Don’t forget to add the assembly full name: $SharePoint.Project.AssemblyFullName$ or you’ll get “The CLR Type...
no comments

Getting “Your query is malformed.Please rephrase your query” Error When Using FQL Query Keyword With Double Quotes

Thursday, April 11, 2013

When trying to use FQL (Fast Query Language) query keyword with double quotes, for example: body: string(“”hello world””, mode=”and”) You’ll get “Your query is malformed.Please rephrase your query” Error.  Since FQL has a problem with double quotes, the trick is to use backslash (\) in front of the quotes,  for example: body: string(“\”hello world\””, mode=”and”) Hope this trick was helpful for you as it was for me.
no comments

SharePoint: Can’t Activate Site Collection Feature When Creating New Site From a Custom Web Template.

Saturday, March 30, 2013

The onet.xml file is basically divided into two parts, first is the "SiteFeatures" element and the second element called "WebFeatures". The "SiteFeatures" Section that holds the site features starts activating all the features only when creating a site collection. The "WebFeatures" Section that holds the web features starts activating all the web scoped features only when creating a site. Scenario: you created a custom web template, deployed the solution and when trying to create a site from you custom web template you get the following error "the site template requires that the feature {GUID} be activated in the site...
no comments

Session at SharePoint Extreme 2013 Conference

Monday, March 18, 2013

Last week i gave a session about What’s new for WCM and Internet Sites in SharePoint 2013 at SharePoint Extreme 2013 Conference. I would like to thank everyone who attended my session and hope to see you soon.  My presentation on SlideShare. What’s new for WCM and Internet Sites in SharePoint 2013 Special thanks to Johnny Tordgeman for hosting a SharePoint 2013 development seminar at the SharePoint Extreme 2013 conference and helping me with this presentation.
no comments

How To Create Custom Search Engine For SharePoint 2013 In Google Chrome

Tuesday, January 1, 2013

A great way to search something on your SharePoint 2013 site or any older version of SharePoint without the need of browsing to the site and start writing your search query cause Google Custom Search is doing it for you. Steps for Adding a Custom Search Engine A) Right click mouse on the address bar and choose “Edit Search Engine” B) You will need to fill 3 text boxes.  Add a new search engine – the name of the search engine, by default, Google Chrome uses the site’s domain name Keyword – use a Keyword that will be easy to remember like “SP” or...

SharePoint Control Overrides My JavaScript “Keypress” Event

Monday, December 3, 2012

When you want to bind an event handler to the "keypress" JavaScript event, or trigger that event on an element, you can achieve this using JQuery  handler like .keypress( handler(eventObject) ) . For example, binding "keypress" event to a text box on your custom control : $("#input").keypress(function (event) { var code = (event.keyCode ? event.keyCode : event.which); if(code == 13) //Enter keycode // your logic here... } });   As you can see, the task is very simple and straightforward, but when dealing with SharePoint , sometimes things get pretty messy. Scenario:  You developed a custom control with a text box and used a "keypress" JavaScript event...