Skip to main content

Youtube Video Search on Sharepoint


Youtube Video Search on Sharepoint!!


Scenario:- Users should be able to search for youtube videos and play them.

Pre-Requsite:- Basics of React and sharepoint content editor webpart.

UI Layout:-
React App steps for build
  1. The react solution has total five componenets of which only one is class based component all other are functional components.
  • App
  • Search Bar
  • Video Details
  • Video List
  • Video List Item
  1. For searching youtube videos from the youtube we use youtube-api-search package. We also need to have an API Key for youtube to know who is searching the videos.
NPM install youtube-api-search
  1. We can use the YTSearch function from the api to perform the search. In the callback function we get the list of videos.
  1. App :- It’s a parent componenet which holds all the child components. Its contains internal state of Videos and selected Video.  
  1. Search :- It’s a functional component where we show a search box and onchange event. Search expects a props for the onchange event. Whenever a search term changes this event gets called.
  1. Video Details:- It’s a functionla componenet which will show the selected videos passed as props to the component. It will display the title and description of the video. We will embed video on the page using the video url.  
  1. Video List Item:- It’s a functional component which shows short information of the video. It handles onclick event to pass the selected video details to the parent component.
  1. Video List:- IT shows the list of videos which are passed as Props to the component. It uses the child component Video List Item to show short video details.

  1. On the App component the UI looks like below which shows all the details.
  1. Build the App and the generate the bundle.js file. Create a html page which contains a div html element with the class container, react components will be loaded under the div element.

Uploading the Files to sharepoint and configure the webpart.
  1. Upload the files bundle.js and index.html to the Style Assets library of the root site.
  1. Create a new page on the root web and add the content editor web part. Edit the properties of the content editor webpart. To refer the uploaded index.html page from the site assets library. Save the settings and publish the page.

  1. The final Youtube search page looks like below.
The complete code to the above app is located in the below git hub location.


Comments

Popular posts from this blog

Sharepoint 2013 REST API limitations with site columns

Recently i attended an interview for one of the company, the interviewer asked me a question on rest api. How to get a publishing image field using rest api? I answered its the normal way how we get the other fields. But later i came to know that its the wrong answer. After some research on Google came to know that there some limitations to rest api in sharepoint 2013. Below is a list of columns available using Rest api. Column Support Notes Hyperlink or Picture Supported Single Line of Text Supported Multiple lines of text :: Plaintext Supported Multiple lines of text :: Richtext Supported Returns unencoded XHTML Multiple lines of text :: Enhanced Richtext Supported Returns unencoded XHTML Choice Supported Column is required in the  $expand  keyword Counter Supported Integer Supported Number Supported Currency Supported Date Supported Returns an ISO 8601 date e.g. 2013-03-08T11:00:00 Yes/No Supported Returns true or false string literals Person or Group Supported Colu

How to upgrade typescript version in a SPFX solution

Why do we need to upgrade typescript version in a SPFX solution? As part of SPFX development we try to install 3 rd party libraries, there is a possibility that we might face type errors. For example, if we try to install ANTD package as part of your solution and use one of its components and try to build the solution. You might be seeing the type errors (TS1005,TS1109) as shown below. Typescript errors How to find out the typescript version? When you build (Gulp build) the SPFX solution you will be able to find out the typescript version from the build log as shown below.  Steps for updating the Typescript version. In SPFX solution typescript version has dependency on the @Microsoft/rush-stack-compiler package version.  In the package.json if you have @microsoft/rush-stack-compiler-2.7 then the typescript version is 2.7.x.    In the SPFX solution deleted the node_modules folder. It will remove all the packages that are installed.  On the package.js

Use of Expression in Microsoft flow through an example

Most of the basic flows can be configured using the templates provided by Microsoft. But in real time we will be developing flows which have complexity. Expression play an important role in fulfilling the requirements. Scenario : -  We have project details list which has the below columns, we need to intimate the project team before 2 days of the end date. (Please note that this scenario is picked up from one of the Microsoft insight demo) The following points needs to be implemented ·          Only title and End time are mandatory fields, Start time if not entered needs to be taken as the current date. ·          Number of days is the difference between the start time and end time.   ·          Email needs to be sent before 2 days of the end date. ·          If any attachments they need to be attached to the mail being send from the flow. Below is the complete flow. If any one needs a copy of the complete flow please drop a comment. Let m