Retrieve VideoSetEmbedCode using Search API
On WCM
I've created new asset library in SharePoint , when I upload a new video I have the option to select an embed video , when I try to query the video Item using Search RESTful API The VideoSetEmbedCode is not appearing , below is the troubleshooting steps i did to overcome the problem
- Open the Central administration
- Click on Manage service Application
- Manage Search service Application
- Click on Search Schema
- Try To search for managed property (no luck)
- Try to search for crawled property (no luck)
- using the powershell I retrieved the Video Item and it got he property ows_VideoSetEmbedCode so why this crawled property is not appearing in the search schema
- I find out that the Field is hidden so I tried to unhide it using powershell and failed
- it turns out that CanToggleHidden is set to false so I used the below code to make it unhidden
using (SPSite site=new SPSite("http://sp:2020")) { SPList list = site.RootWeb.Lists["MediaLibrary"]; SPField videoField = list.Fields.GetFieldByInternalName("VideoSetEmbedCode"); Type type = videoField.GetType(); MethodInfo mi = type.GetMethod("SetFieldBoolValue", BindingFlags.NonPublic | BindingFlags.Instance); mi.Invoke(videoField, new object[] { "CanToggleHidden", true }); videoField.Hidden = false; videoField.Update(); }
I performed full crawling and now it works I can retrieve the VideoSetEmbedCode using Search API (Restful /KeywordQuery)
No Comment to " Retrieve VideoSetEmbedCode using Search API "