Previous two posts were devoted to discussion of how to integrate video from YouTube and another Video Providers into SharePoint. In the first post we have discussed how to store embedded video properties and render YouTube player using Computed Field. In the second one we have discussed how to store embed code itself as it was generated by Provider.
This time we will discuss at how you can aggregate video from RSS/Atom Feeds and provide some information about using API for retrieving video content from Video Providers.
Aggregating from Video Providers RSS/Atom Feeds using YouTube
When you retrieve a video feed or list of search results, YouTube returns an Atom feed. Below is presented description of how to display videos from YouTube Feed, in our case we will display results from YouTube channel only.
For retrieving video content and displaying results YouTube Viewer web part will be used here. In fact, it is just RSSAggregator web part, but with custom XSLT style sheet for processing YouTube feed, for details see implementation section.
So, let’s see how to add video from YouTube feed on page:
- Add YouTube Viewer web part which located under category Media Extensions on page
- Specify FeedUrl for YouTube channel, for example to display video feed from Critical Path Training specify value as shown on picture
- Result page with YouTube web part configured is shown below
Utilizing Video Providers API
The table below represents summary information about API for commonly used Video Providers listed in oEmbed.
Table 1. API support for Video Providers.
And for displaying it we need some logic to be implemented, for example by creating custom web part. Implementation details for this functionality are omitted here.
For aggregating and rendering YouTube Feeds RSSAggregator web part is used as was noted earlier with custom XSLT style sheet for processing YouTube Video Feeds.
To render YouTube feeds we provide custom XSLT style sheet by specifying XslLink property
and the following XSLT style sheet
In previous post we have discussed approach on how to embed video into SharePoint from YouTube. Custom List Video Links were used for storing embedded video properties and Computed Field for rendering Video player.
This time we will extend our solution with the following capabilities:
- Support for different video providers listed in oEmbed
- Preview view for displaying video arranged in list
- Alternative mode for posting the embed code for video into SharePoint
Support for different video providers
In addition to embed code using iframe, another options also available now. Some providers listed in oEmbed specification use object element for embedding code.
Table 1. Support for Video Providers listed in oEmbed specification
Alternative mode for posting embedded code
Additionally to existing mode for embedding video code, the approach described below allows to paste the embed code as it was generated by Provider. Let’s take a look at the common usage scenario:
- Generate and copy the embed code on the Provider website
- Select Embed Code from New Item for Video Links List
- In New Form for Video Links List paste the embed code and fill in comments if needed as shown below
For displaying video player the same (see previous post for details) Computed Field EmbeddedVideoOnForm field is used
Preview view for displaying video
In addition to default view (video player items with details), Preview view is intended to display items arranged by columns as shown below
To paste the embed code we define Embed Code Content Type
where field EmbedCode for storing the embed code is used
As was noted earlier, for displaying video player the same (see previous post for details) Computed Field EmbeddedVideoOnForm field is used, below is presented complete XSLT style sheet for rendering of a field on a List View
The solution described here allows to embed video hosted on YouTube into SharePoint. The same approach may be applied for embedding video from another video hosting sites, for example from Vimeo.
The main idea here to store embedded video properties and not the embedded code itself.
For storing embedded video properties we will use Custom List, see implementation section for description. Page for Video Links list (default view with embedded player) is shown below
In order to embed a video into SharePoint:
- On YouTube site click the Share button located under the video.
- Click the Embed button.
- Copy at least src attribute value provided in the expanded box (see table 1 for supported attributes).
- Create new Video Link item and paste attribute values for embedded code into Video Links item. Save it.
Table 1. Mapping between embedded code iframe attributes and Video Link item
||Video Links field name
Video Links implementation
As was mentioned earlier only properties for embedded video code are stored and not the embedded code itself. For storing embedded video code properties is used Custom List that extends OOB Links List (TemplateType = 103)
For embedded video properties we create Video Link Content Type that inherits from Link CT (0x0105)
where we define the following fields
Pay attention, for rendering YouTube player Computed Field EmbeddedVideoOnForm is intended.
For rendering of a field on a List View the following XSLT style sheet is used
And finally, we create List Definition Video Links from Content Type Video Link. List schema and Template files for Video Links including whole project may be found on GitHub.
- Video Links project on GitHub
- How to embed Vimeo player see here
- How to embed YouTube player see here
- How to customize the rendering of a field in List View see here
Posted in SharePoint 2010
- Tagged Computed Field, Content Type, Custom List, Links List, List Definition, List Schema, List Template, SharePoint, SharePoint 2010, Vimeo, XSLT, YouTube
It is known that OOB Content Query Web Part (CQWP) renders results using Lists for arranging items as shown below
In ASP.NET WebForms for Web Control DataList there is a possibility to specify layout rendering mode using property RepeatLayout, what if the similar functionality would be available in CQWP?
So, our goal to extend CQWP, i.e. in addition to List Layout rendering mode, lets implement functionality for rendering Content Query Web Part results in Plain Old Table Layout.
In this approach, we would like to achieve the following options:
- Possibility to easily arrange results in columns
- Specify items direction (horizontal or vertical)
Content Query Web Part Class
Tool Part Class Implementation with the ability to specify Table Layout properties
Web Part manifest file
Pay attention that we provide custom XSLT for processing of the CQWP, for more details see How to: Customize XSL for the SharePoint Content By Query Web Part.
Main XSLT style sheet for rendering results in Table Layout
Below is shown Web Part configured to display results in 4 columns and horizontal mode layout
As described in Metadata navigation overview (SharePoint Server 2010), metadata navigation includes the following user controls:
- Navigation hierarchies Use and expand the capabilities of list views to navigate hierarchies of folders, content types, choice fields, or managed metadata term sets. This allows users to use list views to filter on a metadata hierarchy just like navigating folders
- Key Filters This control appears below the site hierarchy control and can consist of several fields such as date, choice, content type, single and multi-value fields, currency, yes / no, and user fields. Any number of key filters can be applied in combination with a selected navigation hierarchy.
Navigation hierarchies and KeyFilter user controls registration and also rendering templates for KeyFilter control are defined in MetadataNavTree.ascx and MetadataNavKeyFilters.ascx files.
Our goal here to show possible ways on how KeyFilters control could be customized from the UI perspective.
Below is represented diagram on how KeyFilters control is rendered.
Depending on field type different rendering templates for composite field are applied as shown in table below.
|Composite field rendering template name
||for range capable field such as Choice
||default rendering template for key filters composite field
But KeyFilter control has some limited functionality regarding customizing List Field Iterator and composite field templates, for example it is not possible to specify alternative templates for composite field templates.
One of the possible ways for making KeyFilters control UI customization more flexible is to extend it by allowing to specify custom templates for composite fields.
Project with custom Key Filters control implementation is located here.
Resulting page with custom KeyFilters control and custom rendering templates applied is shown below. In this example control field label and value in composite fields rendering templates are rendered in one row mode.
Sometimes in SharePoint we need to visualize hierarchical data as organizational chart. Prerequisites: not to use Flash or Silverlight technologies here.
So, in our scenario for storage of organization structure will be used SharePoint List based on Custom List , for rendering engine Google Chart Tools.
First, let’s take a look at list’s schema for storing organizational structure
||Used for parent/child relationship
||Display text for chart box
||Visual behavior for chart box
From Google Charts library we’ll use Organizational Chart package only.
1. Google Charts Tools loading and package initialization
2. Fetch data using SharePoint Web Service from list that contains organizational structure
3. Bind data source and draw chart
Result page with Org Structure rendered as Chart in List View
Validation of SharePoint PeopleEditor WebControl on the client-side is often required. On server side validation is supported, see AllowEmpty and ValidatorEnabled properties for details, but the lack of client side validation makes it inconvenient for scenarios where client side validation is mandatory. So let’s discuss some techniques how it could be achieved.
In order to enable/disable validation for Entity Editor based controls (like People Editor) the following properties should be specified in combination:
For example, the code below demonstrates how to disable empty values:
Let’s start with the simple method that allows to check if PeopleEditor control is not empty.
The code below demonstrates how to validate if SharePoint PeopleEditor control value is not empty
It can be used in the following scenarios:
Since jQuery is commonly used in SharePoint front-end development, it validation capabilities could be used for PeopleEditor, for example jQuery Validation plugin. The code below demonstrates how validation rule that allow us to verify if PeopleEditor value is not empty, may look like.