Thursday, March 13, 2014

Introduction to to cross-site publishing in SharePoint 2013

To build our Contoso website, we'll be using cross-site publishing, a new publishing method that's just been introduced with SharePoint Server 2013. Before we start however, let's get a bit more familiar with how cross-site publishing works.
Note: most of features described in this series are not available in SharePoint 2013 online.

What is cross-site publishing?
Cross-site publishing's a publishing method. It lets you create and maintain content in one or moreauthoring site collections, and publish this content across one or more publishing site collections, by using Search Web Parts.

When should you use cross-site publishing?
Use cross-site publishing when you want to store and maintain content in one or more authoring site collections and display this content in one or more publishing site collections. Cross-site publishing will make life easy for you as it:
  • Can be used across site collections, web applications, and even across farms.
  • Separates content authoring from branding and rendering, meaning how you author content has nothing to do with how it is displayed to users.
  • Allows you to mix pages and catalog content.

How does cross-site publishing work?
Cross-site publishing uses search technology to retrieve content. Here's how it works in four simple steps:
  1. You create content in libraries and lists in a site collection where cross-site publishing is enabled. You enable these libraries and lists as catalogs.
  2. You crawl the content in your catalog-enabled libraries and lists. This will add the catalog content to the search index.
  3. You add one or more Search Web Parts to the site collections where you want to display your catalog content.
  4. When users view a page, the Search Web Parts issue queries to the search index. Query results are returned from the search index, and shown in the Search Web Parts.
Cross-site publishing

When you decide to change content in an authoring site collection, the changes you make are shown across all publishing site collections that are using that same content.
You can also add search-driven features like faceted navigation, query rules and usage analytics, all of which we'll be talking about soon.

Feeling confused? Don't panic! I will take you through how this works step by step.
The first thing we have to do, is to create two site collections.


Blog series
On overview of all blog posts in this series can be found here.


Additional resources 
Reference from http://blogs.technet.com/b/tothesharepoint/archive/2013/02/19/an-introduction-to-cross-site-publishing.aspx

View and configure usage Analytic reports in SharePoint Server 2013

In this blog post:
About the usage analytics reports
The usage analytics reports show statistics of how visitors have interacted with the content on your website, for example which item has been viewed the most. The reports are broken down per usage event. This means that by default you’ll be able to see:
  • The number of views for an item.
  • The number of recommendations displayed per item.
  • The number of recommendations clicked per item.
SharePoint Server 2013 creates two usage analytics reports:
  • Most Popular Items – shows usage event statistics for all items in a library or list.
  • Popularity Trends – shows usage event statistics for an item, a site or a site collection.
The reports are automatically updated once every 24 hour when the usage analytics job is run.
View the Most Popular Items report for a catalog
In a cross-site publishing scenario where you are displaying catalog content on a Publishing site, you view the Most Popular Items report on your authoring site. Do the following:

1.  On your Authoring site, go to your catalog.
2.  Click the LIST tab –> Most Popular Items.

Most Popular Items icon
3.  On the Most Popular Items page, use the menu to select which usage event you want to view statistics for.
Select usage event
Note: You can view statistics for the Recommendations Displays usage event in the Popularity Trendsreport.
Change the Recent time period for a usage event
On the Most Popular Items page, there are two time periods: Recent and Ever.
Time periods for Most Popular Items report
The Ever time period shows statistics from the first day a usage event was recorded. The Recent time period is by default set to the last 14 days. To view the default settings of a usage event, do the following:
1.  On the server where SharePoint Server 2013 is installed, open the SharePoint 2013 Management Shell.
SharePoint 2013 Management Shell
2.  At the Windows PowerShell command prompt, type the following commands:
$SSP = Get-SPEnterpriseSearchServiceApplicationProxy
$tenantConfig = $SSP.GetAnalyticsTenantConfiguration([Guid]::Empty)
$event = $tenantConfig.EventTypeDefinitions | where-object { $_.EventTypeId -eq <EventTypeId> }
$event
<EventTypeId> is the numeric EventTypeId of the usage event that you want to view. In the example below, I want to view the Views event, so I entered 1.
View RecentPopularityTimeframe property
The Recent time period is defined by the RecentPopularityTimeframe property. You can change theRecent time period to be anything between one and 14 days. To change the time period, do the following:
1.  In the SharePoint 2013 Management Shell, at the Windows PowerShell command prompt, type these commands:
$SSP = Get-SPEnterpriseSearchServiceApplicationProxy
$tenantConfig = $SSP.GetAnalyticsTenantConfiguration([Guid]::Empty)
$event = $tenantConfig.EventTypeDefinitions | where-object { $_.EventTypeId -eq <EventTypeId> }
$event.RecentPopularityTimeFrame = <TimeFrame>
$tenantConfig.Update($SSP)
<EventTypeId> is the numeric EventTypeId of the usage event that you want to change, and<TimeFrame> is the new time period you want to set for the usage event.

In the example below, I wanted to change the Views Recent time to a week, so I entered 1 and 7.
Change ReceRecentPopularityTimeframe property
2.  To verify the change, at the Windows PowerShell command prompt, type the following command:

$event
RecentPopularityTimeframe parameter set to 7
Notice that the value for the RecentPopularityTimeframe parameter has changed to 7.
Narrow the Most Popular Items report to a specific attribute or category
Viewing usage reports per usage event is useful when you want to find out how visitors are interacting with your site. But many times you want to narrow the report to a specific attribute or category, for example all items that are on sale or all Laptops. To do this, you can use Keyword Query Language (KQL). If you don’t know KQL, don’t worry. You can easily narrow your Most Popular Items report without having much knowledge of KQL.
 In our Contoso catalog, we have a site column called RetOnSale. For each item, the value of RetOnSalespecifies if the item is on sale or not.

RetOnSale site column
To narrow the Most Popular Items report to only show items that are on sale, we’ll use the managed property that represents the RetOnSale site column. In our Contoso scenario, this is RetOnSale (inanother blog post I explain how you can find a managed property name).

In the Search Schema, we can see that the RetOnSale managed property is Queryable. This means that we can use it to narrow the Most Popular Items report.
RetOnSale queryable
To see Views usage event statistics for items that are on sale, on the Most Popular Items page, selectMost Views, and enter RetOnSale=True.
Sort on RetOnSale value
And just like that, only items that are on sale are shown.

You can also narrow usage event statistics to a specific category, for example all Laptops. In our Contoso scenario, the Item Category site column is used to specify the category for each item.

Item Category site colulmn
The managed property name of the Item Category column is owstaxIdProductCatalogItemCategory. TheowstaxIdProductCatalogItemCategory managed property is queryable, which means that we can use it to narrow the Most Popular Items report.
owstaxIdProductCatalogItemCategory is queryable
To see which laptops are viewed most by visitors, on the Most Popular Items page, select Most Views, and enter owstaxIdProductCatalogItemCategory:Laptops
Sort on owstaxIdProductCatalogItemCategory
By narrowing the Views usage event statistics to a specific category, we can verify that the Popular Items Web Part is working correctly on our publishing site. For example, on the Laptops page, notice that the three items that are displayed in the Popular Items Web Part are the same that are shown to have the most Views in the Most Popular Items report that we just narrowed to Laptops.
Verify  most Views
View the Popularity Trends report for an item
There are two ways you can access the Popularity Trends report for an item:
a.  On your catalog, select the item for which want to view the Popularity Trends report. In the ribbon, click ITEMS --> Popularity Trends.
Popularity Trends icon
b.  On the Most Popular Items page, click Popularity Trends.
Popularity trends link
Both of these options will open a Microsoft Excel sheet where you can view the daily and monthly statistics for the item. Each usage event is shown in a separate tab.
Popularity Trends report
About the TailTrimming parameter
While we’re on the subject of usage analytics reports, one usage event parameter that is worth mentioning is TailTrimming. This parameter specifies when the numbers that are shown in the usage analytics reports should be updated.

IMPORTANT: This parameter does not affect how recommendations are calculated.
For example, for the Views usage event the TailTrimming parameter is by default set to 3.
TailTrimming parameter is 3
This means that the usage analytics reports will be updated for an item when the item has been vieweda minimum three times within the last 24 hours. For example, if the item Fabrikam Laptop16 M6000 has been viewed twice within the last 24 hours, these two views won’t show up in the usage analytics reports. If within the next 24 hours the Fabrikam Laptop16 M6000 item is viewed 4 times, the usage analytics report will be updated with 4 views.
The reason the TailTrimming parameter is set to 3 is to avoid having to update items that almost none of your website visitors are interacting with. By not updating these items, you reduce the load on your system. On the other hand, when the TailTrimming parameter is set to 3, the usage analytics reports can be somewhat inaccurate. In the example with the Fabrikam Laptop16 M6000, the two views in the first 24 hours will not show up in the usage analytic reports. Total number of views of Fabrikam Laptop16 M6000 over the last 48 hours will show 4, but in reality, it was viewed 6 times.
If you want the usage analytics reports to be updated regardless of minimum amount of views within the last 24 hours, do the following:
1.  In the SharePoint 2013 Management Shell, at the Windows PowerShell command prompt, type these commands:

$SSP = Get-SPEnterpriseSearchServiceApplicationProxy
$tenantConfig = $SSP.GetAnalyticsTenantConfiguration([Guid]::Empty)
$event = $tenantConfig.EventTypeDefinitions | where-object { $_.EventTypeId -eq <EventTypeId> }
$event.TailTrimming = <TailTrimming>
$tenantConfig.Update($SSP)

Where <EventTypeId> is the numeric EventTypeId of the usage event that you want to change, and<TailTrimming> is the minimum amount of times the usage event has to occur within 24 hours for the usage analytics reports to be updated.
In the example below I wanted the usage analytics reports for the Views usage event to be updated if aViews usage event occurs within 24 hours, so I entered 1 and 0.
Change TailTrimming parameter to 0
2.  To verify the change, at the Windows PowerShell command prompt, type the following command:
$event

Verify new TailTrimming parameter
Notice that the value of the TailTrimming parameter has changed to 0.

So with that, this series has come to an end. Hopefully you now have a better understanding of how recommendations and popular items work, and can start adding them to your website.

Understanding how search results are displayed in SharePoint Server 2013

For an overview of the blog post in this series, go to How to change the way search results are displayed in SharePoint Server 2013.
In this blog post, we’ll learn: 

How search results are displayed by default
When you search for something in a Search Center, your results are displayed differently. For example, in the screenshot below, notice how the icons for Word, PDF, and Excel are displayed for each results. 
Default display of search results
By hovering over the first result, more information about the search result is displayed.

Default PPT hover panel
By hovering over the fourth result, the information that is displayed is different from what you saw when you hovered over the first result.
Default PDF hover panel
What’s going on here, and what’s making the search results display so differently? Well, that’s what I’ll explain in this blog post.


About controlling how search results are displayed

Search results are displayed in a Search Results Web Part. The following screenshot shows how SharePoint uses two display templates to control how information about search results should be displayed:
  1. Item display template - used to control how you want information in the body of the Search Results Web Part to be displayed.
  2. Hover display template - used to control how you want information in the hover panel to be displayed.
Display templates used to display search results

There are 90 default search display templates available. This might seem like a lot, but I’ll explain why there are so many later. To see all the default search display templates, go to Site settings --> Master pages and page layouts. In the Master Page Gallery, click Display Templates --> Search.
When you go to this folder, you’ll see that there’s an HTML file, and a JavaScript file for each display template.
Display templates in Search folder 
To view or edit a display template, use the HTML file. SharePoint automatically transforms the HTML file into an associated JavaScript file when you upload it. Because the two files are associated, any changes you make to the HTML file will be automatically updated in the associated JavaScript file.

I’ll explain how display templates work in later posts. For now, let’s move on to result types. 

About result types
If a user is able to see information about search results directly on the search results page, this will save them the hassle of having to click and open each item to see what it’s about. If you look back at the example in the first section, you can easily see that the first two results are PowerPoint presentations, and that the third result is a Word document.  
To display search results differently, search results have to be sorted into different result types.  A result type distinguishes one search result from another. For example, if a search result is found in a Microsoft Word document, that search result belongs to the Microsoft Word result type. If a search result is found in a PDF file, that search result belongs to the PDF result type.

There are 31 default result types. To see them, go to Site Settings --> Result Types.

For an overview of the default result types, see this TechNet article. You needn’t worry about how default search results are specified; it’s something that happens "under the Hood" in SharePoint.

It’s not possible to edit any of the default result types. However, you can copy them, and add further configurations. I’ll show you how to do this in a later blog post, but first, it’s important that you understand how result types and display templates are connected.
  
About the connections between a result type and display templates
The mechanics of these connections are not particularly straight forward and easy to understand, but let's take a look at it in a step-by-step manner.
  1. Each result type contains a reference to an item display template, for example, Item_PowerPoint.
  2. Each item display template contains a reference to a hover panel display template, for example,Item_PowerPoint_HoverPanel.
Result type to display templates connections - 1


Let’s start with the first connection. To see the connection between a result type and an item display template, go to Site Settings --> Result Types. Select to view a result type, for example Microsoft PowerPoint.
View Microsoft PowerPoint result type
On the Result Type page, in the Display template URL section, you’ll see that there’s a URL that points to a file named Item_PowerPoint.js.
URL to display template
This URL is a reference to an item display template. This means that all search results that belong to the Microsoft PowerPoint result type will be displayed by using the Item_PowerPoint.js display template.

If you look in the Master Page Gallery, you’ll see the Item_PowerPoint.js file and the associatedItem_PowerPoint.html file.

Item_PowerPoint display templates
Now for the second connection. To see the connection between an item display template and a hover panel display template, open Item_PowerPoint.html. You’ll see a reference to a hover panel display template, in this case, Item_PowerPoint_HoverPanel.js.
Reference from item display template to hover panel display template
If you look in the Master Page Gallery, you’ll find the Item_PowerPoint_HoverPanel.js file and the associated Item_PowerPoint_HoverPanel.html file.
Hover panel display templates in Master Page Gallery
 So now you can understand why there are so many search display templates. It’s because four display templates are connected to each result type.

For an overview of the connection between the default result types, item display templates, and hover panel display templates, see this TechNet article.

So, that was pretty straight forward. However, we’re not quite there yet. In addition to the display templates that are connected to a result type, there are additional display templates that are used by all result types.
  
About display templates that are used by all result types
To recap:
  1. Each result type contains a reference to an item display template.
  2. Each item display template contains a reference to a hover panel display template.
...and then we need to add:
  1. Each item display template contains a reference to a common item display template. 
  2. Each hover panel display template contain references to three common hover panel display templates.
Result type to display templates connections - 2
 These common display templates are located in the same Master Page Gallery folder as the display templates that are specific to individual result types.
Common display templates in Master Page Gallery
Each item display template points to the common item display template. The following screenshot shows how the item display template used for the Microsoft Excel result type points to the common display template Item_CommonItem_Body.
Reference to Item_CommonItem_Body display template
Each hover panel display template points to three common hover panel display templates. The following screenshot shows how the hover display template used for the Microsoft Excel result type points to the three common hover panel display templates.
Reference to the three common hover panel display templates
If all these references were a bit confusing, not to worry. In later blogs I’ll be using examples that will make it easier to understand.  At this point, it’s important that you understand how result types are used to categorize different types of search results, and how result types are connected to different display templates.  
  
About display template settings in the Search Results Web Part
Now for the easiest part of the puzzle: How does the Search Results Web Part know how to display search results based on the different result types?
On the search results page, click to edit the Search Results Web Part. In the Web Part Tool Pane, click to expand Display Templates.
Search Results Web Part configuration
 
You’ll see that the radio button Use result types to display items is selected by default. This means that search results will be displayed based on the result type that they belong to. That's it!

For more reference, http://blogs.technet.com/b/tothesharepoint/archive/2013/09/04/understand-how-search-results-are-displayed-in-sharepoint-server-2013.aspx

FAST Search crawling performance has been dropped in multi server farm

SharePoint 2010 and FAST 14 search integration to provide enterprise search solution.

As a administrator, we observed various crawling and performance related issues and found a common fix to most of issues\warnings\errors on FAST servers:

  1. An unhandled exception occurred: The underlying connection was closed: An unexpected error occurred on a receive. at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.Search.Extended.QRServer.ProxyBase.ProcessRequest(UriBuilder uriBuilder, String& contentType, Int64& contentLength) at Microsoft.SharePoint.Search.Extended.QRServer.ProxyWcf.InternalProcessRequest(String request) 
  2. timed out while processing batch. 13141 - 13240. Removing processor server and notifying client of batch failure 
  3. Failed to renew lease 
  4. configuration: No response from the config server. Will wait 300 seconds for config server to respond before proceeding. 
  5. JDBCConnector: Thread : Publisher0 has been inactive for more than 300 seconds. 

Solution
===========
- Fix most of above communication related errors\warning by making below changes on FAST server:

  • To disable TCP/IP Chimney Offload
  • To disable RSS
  • Ensure all of the “offload” settings on the network adapter’s driver are set to Disabled
For more info:http://support.microsoft.com/kb/951037 
http://blogs.msdn.com/b/scottos/archive/2010/09/29/ensuring-a-successful-fast-search-server-2010-installation.aspx 

Use netsh int tcp show global command to check status of it:





Social Settings ribbon on all SharePoint 2010 site web apps

On SharePoint 2010 web site having NG social sites, see this message on every web app "Social Settings: Adding a new item will not create a social event.  Change Settings.



This is by design. Because the solution in globally deployed, there is no way to remove this from a single web app, even if that web app has no social features enabled this message will be displayed. This message is however, only displayed for site owners. Thought there is a bug also filed with NG product team and may find update soon.

Search is not working on NewsGator enabled lookout page on SharePoint site

A SharePoint 2010 farm having NewsGator Social Sites 2010 and FAST Search Integrated environment. After enabling lookout feature of Newsgator on SharePoint mysite web app, user is able to access it but when he try to use search box to find keyword, he dont get the results. 




Confirm, if you have below settings configured in NewsGator Social Platform service application>>Search settings under User Experience section:







If you still still see 0 items in document then You must have this configured correctly.


This is a known issue in which the Lookout search results are zero for documents, when you click on the 'document (0)' header in the Lookout search results it takes you to the search results page (results.aspx) and there you see results for documents for the query term.

Bug Case  is files with NewsGator(sitrion) product team and you may see an fix to it in upcoming release.

Wednesday, March 12, 2014

Solution retract, upgrade takes complete SharePoint down

The question should be as following: Why is my SharePoint Farm down each time I’m Deploying, Retracting or Upgrading a Solution?

Deploying a solution:

Initially, the package manifest is parsed to find assemblies, application pages, JavaScript, CSS Files and other files that are not part of a Feature. These are copied to the locations specified in the manifest. All files contained within a Feature are copied to the Feature directory, a subdirectory of %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES. After solution files are copied to the target computers, a configuration reset is scheduled for all front-end web servers; the reset then deploys the files and restarts Internet Information Services (IIS). Farm administrators can specify when this occurs.

Retracting a solution:

Retracting a solution is the process of removing assemblies, files, resources, safe control entries, Features, and other solution components from computers to which they have been deployed.
In a complete retraction, features are uninstalled first from front-end web servers in the farm. If the solution is web application–specific, solution global files (if any) are removed when the solution is retracted from the last web application to which it is deployed.
Next, Features are uninstalled from databases. Feature-by-Feature, elements are removed from the configuration store. Finally, files are removed from servers in the farm. On individual servers, files that are associated with the Features and site definitions are removed.
On each front-end web server, the following occurs:
  • Internet Information Services (IIS) is disabled.
  • Files are removed from the system.
  • IIS is re-enabled and Microsoft SharePoint Foundation is reloaded when a user browses to a page.

Upgrading a solution:

There are two ways to upgrade a farm solution. Which one is used depends on what kinds of changes have been made in the newer version of the solution.
Replacement: The old version of the solution is retracted, and optionally removed from the farm solution store. The new version is then added to the solution store and deployed. It is not necessary that the new solution package (.wsp file) have the same name or GUID as the old version, however, if the old version is retracted but not removed from the solution store, then the new version must have a different filename and GUID. This kind of upgrade must be used if the new version of the solution differs from the installed version in any of the following ways.
Update: A new version of the solution package is installed and deployed which has a different file name but the same GUID as the old version. The Microsoft SharePoint Foundation deployment infrastructure detects that the GUIDs are the same. It automatically retracts the old version before deploying the new version. If there are Features in the solution, then the new and old versions have the same set of Features and they remain activated but assemblies and certain other files in them are updated with the versions from the new solution package.

Conclusion:

Doesn’t matter with operation that you are executing for your Farm Solution (Deploy, Retract or Upgrade) an IISRESET will always occurIt’s as designed!

What does an IISReset?

When SharePoint uses the iisreset command in IIS 7.0, the IIS Admin Service, the Windows Process Activation Service (WAS), and the World Wide Web Publishing Service (WWW Service) are stopped and restarted. We should avoid using iisreset unless absolutely necessary, because the Web server shuts down all applications that depend on these three services until the services successfully restart. This means that you lose existing state in your applications, your Web sites and applications become unavailable, and you risk unpredictable results by stopping processes before they finish.

A Real Case: 46 Application Pools

App_1
The Microsoft recommended amount of IIS application pools per server is 10. These recommendations are dependent on hardware and load most of the time, but not during IISReset. During an IISReset all the application pools are brought down alphabetically and then brought back up. This takes +- 10 seconds per application pool. è More application pools è longer downtime.
After the installation of each SharePoint GAC solution an IISreset is performed / required by the system. è 10 solutions è 10 IISResets
I’ve tested deployment times on Development / Test machines and here are the results for deploying the same solution on different servers with different amount of application pools running.
Application   pools                            Deployment time           Environment
50:40minPublishing
111:26minStaging
202:56minAuthoring
469:00minDev
As you can see there is a consistent rise in deployment / downtime and the number of application pools.

A Real Case: Workaround

A simple calculation shows us the following:  9:00min X 10 solutions => 90 minutes downtime of your SharePoint Farm (DEV). The business is not happy with that cause their site is down and they cannot use it anymore for 90 minutes at least.
The question can be; why is SharePoint stopping one by one the application pools? What if I stop all the Application Pools manually, made my modification and start my Application Pools again manually?
Seems interesting; lets test ^^

Stopping Application Pools manually

On my server with 46 Application Pools it isn’t easy to bring each of them down. You can use the following script to bring down all your Application Pools:
Import-Module WebAdministration
$applicationPools = Get-ChildItem IIS:\AppPools | ? {$_.state -ne "Stopped"}
foreach($applicationPool in $applicationPools){
Write-host "Stopping application pool ""($($applicationPool.name)"""
$applicationPool.Stop() }

Updating the solution

When all the Application Pools are down please update your solution with the Update-SPSolution command (an example can be):
Update-SPSolution –Identity PEGASUS.solution1.wsp –LiteralPath “d:\Gokan\ PEGASUS.solution1.wsp” –GacDeployment 
We can now check the SharePoint Logs:
11/09/2013 17:03:11 - Solution already exists and will be 'updated'
11/09/2013 17:03:12 - Update-SpSolution PEGASUS.solution1.wsp
11/09/2013 17:03:12 - Update source D:\SPRD2010\Runningjobs\ PEGASUS.solution1.wsp 
11/09/2013 17:04:08 - Solution updated
Now that was fast! 1 minute in place of 9 minutes… Why? Cause we stopped manually the application pools and didn’t wait for the stop and start of each Application Pools that took a crazy time. Now we have to restart the 46 Application Pools again. You can use the following script to start all the application pools under your current farm.
Starting Application Pools manually
Import-Module WebAdministration
$applicationPools = Get-ChildItem IIS:\AppPools | ? {$_.state -ne "started"}
foreach($applicationPool in $applicationPools){
Write-host "Starting application pool ""($($applicationPool.name)"""
$applicationPool.Start() }

A Real Case: Easy words

  1.         Stop all the Application Pools
  2.         Update your Solution
  3.         Start all the Application Pools
  4.         Use Warm-up Script if necessary

Conclusion:

We conclude that the manual start and stop of Application Pools saves us valuable time. We’re avoiding 46 Application Pool restarts (one by one).
Again, this can be useful and will be useful when you have a Major Production Implementation on a Production server where best practices aren’t followed (As you know we shouldn’t have not more than10 Application Pool maximum per server).
Be preventive and make first enough conclusive tests on your development machines before going on Production Servers.
Reference from link