Freigeben über


Item Syndication (News Syndication)

Requirement

There is mostly a requirement to roll up the content across web application or farms. Following the approach that I used to syndicate a news item stored in a list in one of the web application across the farm. Also, discussed below are some of the alternative options that can be used.

The objective for this approach is to apply minimum custom efforts.

Overview 

News syndication is achieved by having a Publisher-Subscriber model where Publisher contains a List where the news items are added. Subscriber uses an OOB Webpart named “Core Search Results” webpart with few customizations to enable subscriber to display syndicated news and apply some filter to it.

We are using of FAST Search Service Application (Fast Content and Fast Query) to enable news syndication across different web applications.

Publisher

A List is to be provisioned at Publisher site with the following columns:

News List

Column Name

Description

Title

Title for the news item

Description

Details of the news. Implemented as Rich Text to enable hyperlinks and other formatting can be incorporated

News Image

The image associated with the news item. Implemented as Url field which point to a “Picture” type

Created On

The date time for when the news item is been created.

Subscriber

A custom web part is created titled “Syndicated News” which extends the functionality of OOB web part “Core Search Results” web part.

Following are the properties it extends:

Property Name

Description

ListPath

Defines the path for the list from which news items are searched. It refers to the publisher’s news list.

Interval

Indicates the day’s interval to filter the news items.

It also presets some of the base class properties by overriding CreateChildControls method. The logic is as follows:

Assembly Name

NewsWebpart

Class Name

SyndicatedNewsWebPart

Base Class

CoreResultsWebPart

Overridden Method

CreateChildControls

Logic

// Setting up the properties to customize the display this.ShowActionLinks = false;

this.bForceOnInit = false;

if (this.ListPath != string.Empty && this.Interval != 0)

{

DateTime previousDate = DateTime.Now.AddDays(-1 * this.Interval);

string query = string.Format("path:'{0}' & isListItem:true & write>={1}", this.ListPath, previousDate.ToShortDateString());

this.FixedQuery = query;

}

string styleBaseUrl = SPContext.Current.Site.RootWeb.Url;

// Expecting XSL to be existing within the routed library.

this.XslLink = string.Format("{0}/Style Library/XSL Style Sheet/NewsStyle.xsl", styleBaseUrl);

base.CreateChildControls();

As indicated by above code, webpart also uses the custom XSL Stylesheet in order to display the news items in a specific format that includes the image thumbnails of the news item. This XSL file resides in the root web of the web application at following path:

<RootWeb>/Style Library/XSL Style Sheet/NewsStyle.xsl

Deployment Constraints

Both the xsl stylesheet and custom webpart is deployed using a feature scoped at Site Collection Level. For a web part to show content as specified for News Item, the style sheet is required to be placed in existing Style Library.

Dependencies

Microsoft.Office.Server.Search.WebControls

FAST Search Considerations

In order for displaying News Item we are required to crawl the list content (news item) from the Publisher using FAST Search Service Application (FAST Content) in a specified frequency (daily or hourly). Hence, in order to maintain the frequency of crawling we have a separate Content Source “News Crawl” scoped at Site Level where the News List resides. Following are the design aspects that are needed:

News Crawl Content Source

Property Name

Value

Name

News Crawl

Start Addresses

The URL of the site where the News List exists

Content Source Type

SharePoint Sites

Crawl Settings

Check “Crawl everything under the hostname for each start address

Full Crawl

Weekly or blank (as it is required only once)

Incremental Crawl

Set the frequency daily or hourly.

After the first Full Crawl the news content will be available for syndication.

Also, in order to display the Image (New Image column) of the Source list, the crawled property “owsnewsimage” is required to be mapped to “PictureThumbnailUrl” managed property. This is accomplished by mapping the crawled property to Managed property from FAST Query Service Application after successful full crawl is done.

The mapping of crawled property to managed property is done under FAST Search Administration page with in FAST Query Service Application.

Alternative Approaches

Following are the alternative approaches which can be considered in order to provide Item Syndication across web application and farm.

CrossListQueryInfo

The CrossListQueryInfo can be used to query a list across web application. Caching can used along with the query in order to provide the optimum performance. More details can be taken from this URL https://www.c-sharpcorner.com/uploadfile/bhushangawale/cross-web-application-query-sharepoint/

This approach is workable but it requires same App pool account across all web application or the app account of the source should be added as an dbowner for the content database for all web application.

Federated Search Core Result Webpart with List RSS Feed

The Source list can be exposed as RSS feeds and Federated Content Source can be created in FAST Search Content Source can be added to query the RSS Feeds. (This requires setting any kind of authentication requirements within content source.)

A Federated Search Core Result Webpart can then be used to query the source and display result along with XSL transformation as done above.

The benefit of using this approach is that a runtime result is displayed to the user, and it doesn’t depend upon crawl frequency as in the chosen approach. Alternatively, the performance of the page load is been compromised here.

More details can be obtained from the following link

https://www.sharepointanalysthq.com/2010/06/creating-an-rss-reader-using-a-federated-search-web-part/

Custom Webpart with FAST Query Language

Above chosen approach can be extended by developing a custom webpart that make an FQL (Fast Query Language) to Source List and returns the dataset. This dataset can be used to provide user a post approval processing before displaying the content using CQWP webpart.

Content Deployment Feature

In order to provide extensive solution for approval process post receiving the syndicated items, also if syndication are required to happen across farm, this option can be explored.

More details can be obtained from this link https://technet.microsoft.com/en-us/library/ee721058.aspx

Download Code here

Technorati Tags: Sharepoint 2010 News Syndication Cross Web Application Roll Up Content Deployment Syndication Item Syndication