Microsoft exposes almost everything through REST API’s these days, which is excellent!
Not only Mail, Contacts, Calendar and Files, but also Video. In this post I’m going to show you some simple steps to interact with Channels using the REST Video API. But first some basics.
Video Portal basics
The Video Portal exists of a video hub, channels and video’s.
The hub functions as a sort of root, which it isn’t hierarchically speaking. The hub shows all the channels, trending video’s and other stuff you can configure in the Portal Settings section to show eg video’s from a certain channel and some spotlight video’s.
From the hub a single channel can be accessed through the Channels overview. When a single channel is selected the button Channel Settings is available when you have enough permissions. Here items like channel name, color, permissions etc can be configured.
The hub and channels are all separate site collections. The hub and the default Community channel are visible in the SharePoint admin center, including the storage used, storage limit, etc as shown in the picture below.
User created channels, site collections, are hidden in de SharePoint admin center. These site collections are perfectly fine accessible by their url. For example a channel named MyChannel was created. The server relative url would then be /portals/MyChannel.
The site collection is used to store video’s, settings and permissions.
A library called Videos stores all the original video’s uploaded into the channel. Also the thumbnail generated after processing the video by Azure Media Services is stored in this list and other metadata about the video. A video is based on a content type called Cloud Video. Besides the ‘regular’ columns as Title and Description other columns are present:
- People in Video
- Categories – managed metadata, can be set to a term set of your choice.
- Thumbnail preview
- Length (seconds)
- Frame width
- Frame height
Since the video is stored in SharePoint the video file size limit is the same as SharePoint file size limit.
Another important list is the Channel Settings list. In this list the channel name, tile color and spotlight videos are stored.
The groups Creators, Contributors and Viewers are the groups meant in the channel settings accessible from the hub at the Permissions tab: Owners, Editors and Viewers.
Now you have a basic understanding of the hub and the channels, let’s do some code.
At the hub level a list of channels is available, but it’s only a list of the channel name and the color, no other information is shown here.
Let’s show the users in the permission groups set at the channels next to the channel so a more informative overview is created.
This is a simple example of using the Video REST API and the SharePoint REST API. The Video REST API is used to get information about the video portal and the channels, the SharePoint REST API is used to get the users of some groups.
First a request has to be created to the Video portal’s discovery endpoint to discover whether the video portal is set up and enabled and to get the URL of the video portal.
The Video portal root url is used in subsequent calls.
There are two options to get a list of channels. /_api/VideoService/CanEditChannels can be used to get channels he user has Owner or Editor permissions and /_api/VideoService/Channels can be used to get channels the user can view.
The picture above shows the response of the call.
These are the only calls needed to the Video REST API. To request the users in the specified groups the SharePoint REST API can be used like:
https://<channelurl>/_api/web/sitegroups/getbyname(‘<name of the group>’)/users
And the users in the group are returned.
In this post the basics about the video portal and channels are explained.
The above overview was just a quick demo with a small amount of channels. Production code should probably contain code more based on search.