Showing posts with label SharePoint Search. Show all posts
Showing posts with label SharePoint Search. Show all posts

2/15/2018

Run SharePoint 2013 and 2016 Search Reports from PowerShell


Updated to include IDs for SharePoint 2016!   Original article here.


Update! Need these reports for every site collection in the farm? See Part 2: http://techtrainingnotes.blogspot.com/2015/04/run-sharepoint-2013-search-reports-from_21.html


In my Search Administration class I stress that admins should dump the search reports on a regular basis as the data is only kept in detail for 14 days and in summary form for 35 months. But who wants to both run these reports at least once every 14 days, even they can remember to do so. So, PowerShell to the rescue… Schedule this script to run each weekend and your work is done.

The following script works for on premise SharePoint 2013. To work with Office 365 you will have to figure out how to include your credentials. The example included here works on premises by using "UseDefaultCredentials = $true".

After lots of hacking, detective work (see below) and just plain trial and error, here's the script:

# This is the URL from YOUR Central Admin Search Service Usage Reports page:
#
# The script will not work unless this is correct!
# $url = "http://yourCentralAdminURL/_layouts/15/reporting.aspx?Category=AnalyticsSearch&appid=ed39c68b%2D7276%2D46f7%2Db94a%2D4ae7125cf567" # This is the path to write the reports to (must exist, but can be anywhere): $path = "c:\SearchReports\" function Get-SPSearchReports ($farmurl, $searchreport, $path, $version) { # TechTrainingNotes.blogspot.com
if ($version -eq "2013")
{ # Report names and IDs $Number_of_Queries = "
21be5dff-c853-4259-ab01-ee8b2f6590c7" $Top_Queries_by_Day = "56928342-6e3b-4382-a14d-3f5f4f8b6979" $Top_Queries_by_Month = "a0a26a8c-bf99-48f4-a679-c283de58a0c4" $Abandoned_Queries_by_Day = "e628cb24-27f3-4331-a683-669b5d9b37f0" $Abandoned_Queries_by_Month = "fbc9e2c1-49c9-44e7-8b6d-80d21c23f612" $No_Result_Queries_by_Day = "5e97860f-0595-4a07-b6c2-222e784dc3a8" $No_Result_Queries_by_Month = "318556b1-cabc-4fad-bbd5-c1bf8ed97ab1" $Query_Rule_Usage_by_Day = "22a16ae2-ded9-499d-934a-d2ddc00d406a" $Query_Rule_Usage_by_Month = "f1d70093-6fa0-4701-909d-c0ed502e3df8" }
else # 2016
{
$Number_of_Queries          = "df46e7fb-8ab0-4ce8-8851-6868a7d986ab"
$Top_Queries_by_Day         = "06dbb459-b6ef-46d1-9bfc-deae4b2bda2d"
$Top_Queries_by_Month       = "8cf96ee8-c905-4301-bdc4-8fdcb557a3d3"
$Abandoned_Queries_by_Day   = "5dd1c2fb-6048-440c-a60f-53b292e26cac"
$Abandoned_Queries_by_Month = "73bd0b5a-08d9-4cd8-ad5b-eb49754a8949"
$No_Result_Queries_by_Day   = "6bfd13f3-048f-474f-a155-d799848be4f1"
$No_Result_Queries_by_Month = "6ae835fa-3c64-40a7-9e90-4f24453f2dfe"
$Query_Rule_Usage_by_Day    = "8b28f21c-4bdb-44b3-adbe-01fdbe96e901"
$Query_Rule_Usage_by_Month  = "95ac3aea-0564-4a7e-a0fc-f8fdfab333f6"
} $filename = $path + (Get-Variable $searchreport).Name + " " + (Get-Date -Format "yyyy-mm-dd") + "
.xlsx" $reportid = (Get-Variable $searchreport).Value $TTNcontent = "&__EVENTTARGET=__Page&__EVENTARGUMENT=ReportId%3D" + $reportid # setup the WebRequest $webRequest = [System.Net.WebRequest]::Create($farmurl) $webRequest.UseDefaultCredentials = $true $webRequest.Accept = "image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, */*" $webRequest.ContentType = "application/x-www-form-urlencoded" $webRequest.Method = "POST" $encodedContent = [System.Text.Encoding]::UTF8.GetBytes($TTNcontent) $webRequest.ContentLength = $encodedContent.length $requestStream = $webRequest.GetRequestStream() $requestStream.Write($encodedContent, 0, $encodedContent.length) $requestStream.Close() # get the data [System.Net.WebResponse] $resp = $webRequest.GetResponse(); $rs = $resp.GetResponseStream(); #[System.IO.StreamReader] $sr = New-Object System.IO.StreamReader -argumentList $rs; #[byte[]]$results = $sr.ReadToEnd(); [System.IO.BinaryReader] $sr = New-Object System.IO.BinaryReader -argumentList $rs; [byte[]]$results = $sr.ReadBytes(10000000); # write the file Set-Content $filename $results -enc byte } # Note: Change the version to 2013 or 2016
Get-SPSearchReports $url "
Number_of_Queries" $path "2013" Get-SPSearchReports $url "Top_Queries_by_Day" $path "2013" Get-SPSearchReports $url "Top_Queries_by_Month" $path "2013" Get-SPSearchReports $url "Abandoned_Queries_by_Day" $path "2013" Get-SPSearchReports $url "Abandoned_Queries_by_Month" $path "2013" Get-SPSearchReports $url "No_Result_Queries_by_Day" $path "2013" Get-SPSearchReports $url "No_Result_Queries_by_Month" $path "2013" Get-SPSearchReports $url "Query_Rule_Usage_by_Day" $path "2013" Get-SPSearchReports $url "Query_Rule_Usage_by_Month" $path "2013"


The Detective Work…

I could not find anything documented on how the reports are called or details on things like the report GUIDs. So here's how I got there:

  • Go the search reports page in Central Admin and press F12 to open the Internet Explorer F12 Developer Tools then:
    • Click the Network tab and click the play button to start recording.
    • Click one of the report links.
    • Double-click the link generated for the report in the F12 pane to open up the details.
    • Make note of the URL (It's the same as the report page!)
    • Note the Accept, and Content-Type Request Headers.
    • Click the Request Body tab.
    • Stare at 3000 characters in that string until your head really hurts, or until you recognize most of what is there is the normal page postback stuff like VIEWSTATE. So we need to find what's unique in the string. (It's the Report IDs.)
    • Click on each of the nine reports and copy out the report IDs.
    • With a lot of trial and error figure out what the minimum string needed is to generate the reports. (It's ""&__EVENTTARGET=__Page&__EVENTARGUMENT=ReportId" plus the report id.)
    • Find out how to do an HTTP POST using PowerShell. (Steal most of it from here: http://www.codeproject.com/Articles/846061/PowerShell-Http-Get-Post.)
    • Find some other needed .Net code and convert the C# to PowerShell.
    • Fill in some gaps with PowerShell putty …….


.

        1/22/2018

        SharePoint Search Weirdness – Part 5: Search REST API Ignores Duplicates


        A continuation of the "Search Weirdness" series!


        If you are a developer, or a SharePoint 2013 workflow designer, then you probably have used the SharePoint Search REST API. Did you know that you are probably not getting all of the results expected?

        Here’s a typical REST search for the word “sharepoint”:

        http://yourSiteUrl/_api/search/query?querytext='sharepoint'

        Or if you would like to be a little more selective:

        http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'

        or you would like to return more than the default number of items:

        http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'&rowlimit=1000


        The problem with the above searches is that Search thinks some of your results are duplicates, so it removed them! To solve this problem just add this to your URL:

            &trimduplicates=true

        Your search URLs then might look like these:

        http://yourSiteUrl/_api/search/query?querytext='sharepoint'&trimduplicates=true

        http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'&trimduplicates=true

        http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'&rowlimit=1000&trimduplicates=true


        .

        3/31/2017

        SharePoint Date Search Tips

         

        Applies to SharePoint 2013 and later.

         

        A few SharePoint Search Tips!

         

        Time Zone

        Search internally stores dates in Universal Time. Because of this, a file uploaded at “2/7/2017 10:50 PM EST” will not be found with a search for “Write=2/7/2017” (or “LastUpdateDate=2/7/2017”). That file will be found with a search using “Write=2/8/2017”.

         

        Date Ranges

        You can create searches on date ranges using “..”.

              Example: write=2/1/2017..2/8/2017

         

        Named Date Ranges

        You can also use the names of some date ranges. Quotes are required around any range name that includes a space.

             Example: write="this week"

            image

        The supported ranges are:

        • today
        • yesterday
        • this week
        • this month
        • last month
        • this year
        • last year

        But sadly… no “"last week”!

         

        Comparison Operators

        Note: All of the following operators work with the DateTime, Integer, Decimal and Double data types.

        Operator

         
         

        Equals

        <

        Less than

        >

        Greater than

        <=

        Less than or equal to

        >=

        Greater than or equal to

        <>

        Not equal to

        ..

        Range

         

        .

        5/31/2016

        SharePoint: Search for People using Properties (LastName:smith)

         

        The typical SharePoint end user knows less than 1% of the SharePoint Search feature set. In other words, they know how to do a Google search. They just type a word or two, press Enter and hope for the best. Just think what they could do if they just knew a few search properties!

        You can really improve search results by adding a Search Administrator to your team and letting them invest an hour or three a week in improving the end-user search experience. Train your end users, add tips to your search pages, create cheat sheets - there’s lots of options.

        Just adding a few search tips to the search pages will do wonders:

           image

        So, let’s take a look at how users can do a better People search…

         

        Searching for People

        Let’s say I do a search for people using the keyword “training”. I could find people in the Training department, people with the word “training” in About Me, and even people with the last name of “Training”. If you would like to focus your search then you can use the predefined search Managed Properties. For example:

           image

        While a few of the properties can be used with the equals operator (“=”), most will only return results with the contains operator (“:”). For example, searching for a work phone number using “=” returns nothing. Using “:” will return the person with that number.

           image

         

        Managed Properties for People Searches

        Most of the User Profile properties are searchable in a People search by just typing a keyword in the search box. You can also perform a People search using some of the out of the box Managed Metadata properties that are linked to the User Profile Services properties. In the table below you will find most of the User Profile properties along with the matching search Managed Property names. A few of the properties below have obvious names. A few are wrapped up in a single search property named “ContentHidded”. Some are “indexed” (crawled), but do not have the needed matching Managed Property. For most of those that do not have a matching Managed Property you can manually add a property to the search schema.

        I will follow up with an article on adding the missing search Managed Properties.

        Property for search

        Property name found in the user’s profile

        Notes

        AccountName Account Name Example: accountname:contoso\samc
        AboutMe About Me  
        Interests Interests  
        Responsibility Ask Me About  
        FirstName First name  
        LastName Last name  
        PreferredName Name This is the full name. “Mike Smith”
        WorkPhone Work Phone To find all users in the same area code or a partial number, use wild cards: workphone=513*
        JobTitle Title  
        WorkEmail Work Email  
        MobilePhone Mobile phone  
          Home phone Mapped to ContentsHidden. Can be mapped to a new Managed Property.
          Fax Not mapped, but can be. (People:Fax)
             
        Department Department This is a String property. This department maps to “Department”
          Department This is a Managed Metadata property. Not mapped, but can be. (People:SPS-Department)
        Schools Schools  
        If you see this list anywhere but on TechTrainingNotes.blogspot.com, then it was “stolen” and used without permission.
        OfficeNumber Office Generally used for “room number”.
        BaseOfficeLocation Office Location  
        PastProjects Past Project  
        Skills Skills  
          Manager Not mapped, but can be. (People:Manager) (returned as domain\username)
          Assistant Not mapped, but can be. (People:Manager) (returned as domain\username)
          Birthday Not mapped, but can be. (People:Birthday) (returned as “2000-03-01T00:00:00.0000000Z”)  All birthdays are set for year 2000.
          Hire Date Not mapped, but can be. (People:SPS-HireDate)
        ContentsHidden (many)

        This maps to several crawled properties as a single merged property:
        People:Office
        People:SPS-PastProjects
        People:SPS-School
        People:WorkPhone
        People:CellPhone
        People:Fax
        People:HomePhone
        People:SPS-MemberOf
        People:AboutMe
        People:OrganizationParentNames

         

        .

        10/09/2015

        SharePoint Saturday Cincinnati - SharePoint 2013 Search Results Customization

         

        SharePoint Saturday Cincinnati is almost here! In fact… it's tomorrow. I thought I'd do something a little different this time and put out a little teaser on my topic. To be fair though… there's 19 other cool topics planned for Saturday, just click here to see the schedule.  Register NOW!   http://bit.ly/1DAprtv

         

        So a bit about my presentation…

        SharePoint 2013 Search Results Customization

        Let's start with a problem… Our users can't find a certain kind of document; for example, PowerPoint presentations about our R&D projects. And when they find them, they don't know which ones are highly confidential, and more than once they have shared them with the wrong people.

        And then a solution…

        • Create Site Columns for consistent metadata and to support Managed Property searches such as"ResearchGroup=aviation".
        • Configure the search schema to support friendly property names and the ability to search using "<" and ">" on dates and numbers.
        • Create a Content Type to ensure document classification and to collect important metadata.
        • Create a Display Template to add useful information to the search results, and display our Governance policies for R&D documents. ("Warning… confidential content. Do not share!")
        • Create a Result Type to map the Content Type to the Display Template.
        • Create a user friendly and governance friendly search results page.

        All in an hour! 

         

        See you there!

         

        .

        9/08/2015

        New SharePoint 2013 Search for Power Users Class

         

        I'm very pleased to announce my latest Courseware Marketplace course! 55141AC SharePoint 2013 Search for Power Users. While the class has not shown up yet on the Microsoft Learning site, it should be here shortly. MCTs can download it today at https://shop.courseware-marketplace.com. You can attend it soon at Microsoft training centers around the world.

        If you can't find the class near you, you can attend the class in Cincinnati or remotely at MAX.

        SharePoint Search Class 1200

         

        Oh, don't forget the administrators! We have a SharePoint 2013 search class just for them: 55122AC Microsoft SharePoint 2013 Search Administration. If you can't find the class near you, you can attend the class in Cincinnati or remotely at MAX.

        SharePoint-Search-Class-Administrator-1200

         

        .

        7/13/2015

        SharePoint 2013: Center or Centre? Search knows the US/UK spelling variations!

         

        Weird what you stumble across in SharePoint! There is no end to finding things!

        Center or Centre? Organization or Organisation? Harbor or Harbour?

        SharePoint 2013 search, both On Prem and Office 365, appears to have a US/UK synonym list built-in. I can't find documentation for it anywhere, but it seems to work as expected. Below a few of the words I tested. Search for one and you will find documents with the other.

        • center/centre
        • neighbor/neighbour
        • organization/organisation
        • color/colour
        • flavor/flabour
        • honor/honour
        • caliber/calibre
        • practice/practise
        • license/licence
        • defense/defence
        • connection/connexion
        • realize/realise
        • spelled/spelt
        • analyze/analyse

        My editor's spell checker marks all but one of the second terms as misspelled! It seems to like "spelt".

        To see a list of these common spelling variations see https://en.wikipedia.org/wiki/American_and_British_English_spelling_differences

         

        .

        7/06/2015

        Using SharePoint Search To Find Sites You Have Access To


        Did you ever wonder if there's more to SharePoint? Sites you may have permissions to, but no one ever told you about? Sites like the rumored jokes site and the "free stuff" site? You can use search to find these sites!
        ContentClass is a SharePoint 2013 Managed Property that is used to find many SharePoint things by their "type". Two ContentClass values of interest when searching for sites are "STS_Site" and "STS_Web".
        Tip: For more on what you can do with ContentClass see SharePoint Power Searching Using ContentClass and also here: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

        STS_Site

        The STS_Site property is used to find site collections, or actually just find the top level sites of site collections. To list all of the top level sites that you have permissions to see, search for "ContentClass:STS_Site". (See warning below!)
        image
        My test user Sam found 8 site collections and my administrator account found 38.

        STS_Web

        The STS_Web property is used to find subsites. To list all of the subsites that you have permissions to see, search for "ContentClass:STS_Site". (See warning below!)
        image
        Sam found 9 subsites while my administrator account found 158.

        Find all sites you have access to…

        Just combine both searches with an "OR" to show all of the sites you have access to. (Remember that Boolean operators like AND, OR and NOT must be in UPPER case.)
        image

        Adding Keywords

        A little tip: If you add keyword to your STS_Web and STS_Site queries you will not be searching content in the site. You instead will be searching for that keyword as a property of the home page or content that might be displayed on the home page. The following search will only return results when "plane" in somewhere on the home page of the site:
        image

        Warn'n matey, here be dragons, or at least duplicates…

        SharePoint 2013 search hides duplicates by default and treats many of the things returned by STS_Site and STS_Web as duplicates. Over half of my subsites are missing using an out of the box search! Administrators can fix this little issue by following the "Option 2" steps here: http://techtrainingnotes.blogspot.com/2015/04/sharepoint-2013-search-weirdness-part-1.html.

        STS_Site <> SPSite

        A note to developers and administrators: SPS_Site is not the same as SPSite. It's actually finding SPWebs, but only finding those that are top level webs.

        .

        6/30/2015

        SharePoint 2013 Search Weirdness – Part 4: More Duplication Weirdness

         

        A continuation of the "Search Weirdness" series!

        How many Announcement Lists do I have?

        In the first article of this series I showed how something like a series of Purchase Orders that differ in only the PO number, date and a few other details can appear to SharePoint 2013 search as duplicates and be excluded in the default search results. I have found something stranger… it seems that sometimes all Announcement lists look the same to search and are also treated as duplicates. Lists!

        As an example, I did a search to find all Announcement lists using ContentClass:STS_List_Announcements and found only 8 in my entire test farm.

           image

        I then edited the search results page and changed the duplicates setting (steps here) and then found all 23 of the Announcement lists.

           [image%255B35%255D.png]

        I duplicated the issue in both a test farm (15.0.4649.1000 June 2014 CU) and in the today's version of Office 365. Going forward I'm recommending that the "Remove Duplicates" feature be disabled on all search result pages. Now all I need to do is write a PowerShell script to do this.

         

        Another Test

        Just in case it has something to do with the Enterprise Search Center, I tried the test using "This Site" in a site that had two announcement lists, one titled Announcements and the other titled Jokes. The search only found one list. Note that in the refiner section there are two authors listed. If I click Sam then I can see the Jokes lists while if I click Mike I can see the Announcements list. But never both! The refiner seems to know that they are both there.

        image

        _layouts/15/osssearchresults.aspx

        The problem with this duplicate problem is that the "This Site" search sends me to the _layouts/15/osssearchresults.aspx page, which is not customizable with Edit Page. I have no place to turn off the "Remove Duplicates" feature!

         

        Solution?

        In the Enterprise Search Center, edit each results page to turn off the "Remove Duplicates" feature. For "This Site"… tell the users to use "Everything" instead, which redirects them to the Enterprise Search Center.

        If you need to restrict the "Everything" search to a single site then use this:

           contentclass:STS_List_Announcements   site:yourserver.sharepoint.com/sites/training

        Fun……………………

         

        .

        6/17/2015

        SharePoint 2013 Search Weirdness – Part 3: When do Daily and Weekly Search Alerts Get Sent?

         

        A continuation of the "Search Weirdness" series!


         

        Search Alerts are Different!

        Unlike list and library alerts:

        • You cannot create them for other people. There's no place to type an email address.
        • You cannot request an immediate alert.
        • You cannot pick a time:

        List / Library alert options:

        image

        Search Alert options:

        image

         

        So when are they run?

        You would assume (always a dangerous thing to do) that Daily and Weekly summary search alerts would get created overnight. Turns out they get sent at an exact time, but a different one for each alert!

        While working on a new SharePoint 2013 search class I was trying to find out which timer job created the alert emails and if I could set the time they are sent. TechNet documents only a single timer job, "Immediate Alerts", that runs every five minutes. While I could change that interval, I could not find an option for the "nightly jobs". Turns out there isn't any such thing.

        I had always assumed (again, dangerous) that these ran overnight. The only documentation I had found in TechNet only said this:

        "The daily alerts will have a 24-hour day, date, and time span calculated and stored in the respective database table. A weekly alert will have a seven-day day, date, and time span calculated and stored as part of the individual alert record."

        It just says "calculated" and does not say "when". Then I ran across this blog article by Chris Domino and the light bulb went off:

        http://www.chrisdomino.com/blog/post/The-Truth-About-How-Daily-SharePoint-Alerts-Actually-Work

        When you create a daily alert it is scheduled to run every day at the time you created the alert. I.e. You created the alert at 2:00PM, it will processed every day shortly after 2:00PM. The same applies to weekly alerts. You created the alert at 2:00 PM on a Tuesday, it will be processed every Tuesday at 2:00 PM. I went out and looked as the SQL tables (never do this at home!) and there it was, to the minute, scheduled 24 hours or 7 days in the future.

         

        But that's for an on-premises SharePoint installation. Office 365 is different!

        In my Office 365 tenant my daily alerts are initially scheduled 17 hours in the future and then every 24 hours after that. My guess is that Office 365 is using GMT. So when I schedule a daily alert at 3:45 PM it runs 8:45 AM every day. Five hours off. Hum…  would that mean my tenant is running in Central time? Don't know… just guessing…

         

        Another day… another new thing to discover…

         

        .

        6/16/2015

        SharePoint 2013 Search Weirdness – Part 2: Can't Find My Videos!

         

        A continuation of the "Search Weirdness" series!


         

        Can't Find My Videos!

        I have a bunch of videos in my site. They could be anywhere:

        • A document library
        • An Assets library
        • An Office 365 Video Portal
        • An attachment to a list

        How do I find them?

         

        By File Type?

        So to try to find them all I try this search:

        image

        But…
        image

        Ok, that was because the "wmv" file type is not in Central Administration's list of File Types. As we cannot change that in Office 365, we need a more universal method. So how about:

        image

        Ok, now I have results! But… only 12 files, and I know I have many more!

         

        By the file extension alone?

        What if we just search for "WMV"? Well, it depends… First, that's just one of the possible video extensions. Second, you will find any file that has those three letters, such as an acronym. But… (there's always a "but") In Office 365 / SharePoint Online the file extension is not indexed in Asset libraries. Strangely, with 2013 On Premise the text "WMV" is indexed, but not as a file extension. I.e. you can find the Asset library videos using "WMV", but not "SecondaryFileExtension:WMV".

        image

        Ok, found a few more files!

         

        By Content Types?

        That's a good idea, but this will not find videos assigned a default content type (like those uploaded using drag and drop) or stored as list attachments. Also, the "video" content type is used in Asset libraries, not in Video Portals.

        image

        Or better, use the video content type IDs:

        ContentTypeId:0x0120D520A808* OR ContentTypeId:0x010100F3754F12A9B6490D9622A01FE9D8F012*

        The first content type for "Video" as found in the Asset libraries. The second content type is for the Office 365 Video Portal videos. The "*" is added to include any content types you create that inherit from these two.

         

        By File Name?

        Ok, I know the file name of one of the videos, and I know people have uploaded it to multiple sites… So let's try a name search.

        image

        Found some files!  These were found in a document library, an Assets library and an Office 365 Video Portal. But… only three, and I know there are more.

        As the file name is relatively unique, let's try just that…

        image

        Ok, now I have found four of the airshow2 videos. Where did the extra one come from? The new file is from a folder in the same library. I think SharePoint saw it as a duplicate and ignored it the File Name search, but for some reason displayed it in the "name without extension" search. (See What's a Duplicate?)

        But's there at least two more hanging around. one is an attachment to an announcement, and will not be found by file name! The other was uploaded to an Asset library and the user gave it a new "title" while uploading it. The real file name is buried there, but search does not see it. (See SharePoint 2013 Asset Library Secrets!)

         

        What about a "Videos" search?

        The Enterprise Search Center adds a "Videos" search vertical.

        image

        This search also found four of the videos by that name, but also missed the attachment. The Local Video Results Result Source uses two content types and nine file extensions to try to find videos.

        (
         ContentTypeId:0x0120D520A808* 
         OR ContentTypeId:0x010100F3754F12A9B6490D9622A01FE9D8F012* 
         OR (
             SecondaryFileExtension=wmv OR 
             SecondaryFileExtension=avi OR 
             SecondaryFileExtension=mpg OR 
             SecondaryFileExtension=asf OR 
             SecondaryFileExtension=mp4 OR 
             SecondaryFileExtension=ogg OR 
             SecondaryFileExtension=ogv OR 
             SecondaryFileExtension=webm OR 
             SecondaryFileExtension=mov
            )
        )

        Notes: The first content type for "Video" as found in the Asset libraries. The second content type is for the Office 365 Video Portal videos. The "*" is added to include any content types you create that inherit from these two.

         

        What's going on here???

        File extensions:

        • The common video file extensions are not in the default list of files types used by search. So FileType:wmv will not work.
        • While an on premise admin can add these extensions to the search service, Office 365 admins cannot.
        • Use the SecondaryFileExtension property when searching by file extension.
        • Searching by file extension is not useful when the videos are stored as an attachment or in an Asset library.

        File names:

        • Search does not index the file name for attachments.
        • Files uploaded to an Asset library and renamed by the user will not be seen by search by the original file name. (Even though the file still has the original name!)

        Attachments:

        • The content of an attachment gets merged with the content of the item and are indexed as a single entity. As a video generally has no useful text content, it will not usually be found by search when attached to a list item.

         

        Best Practices?

        1. Use good governance to encourage a single way to store videos. Whether that is a Video Portal in Office 365 or an Asset library when on premise. It probably does not matter where, as long as there is a consistent way to find videos. Avoid storing videos in regular document libraries.
        2. Use Asset libraries when metadata and a convenient player/viewer is needed.
        3. Use a Video Portal when using Office 365 / SharePoint Online AND metadata is not important. The only "metadata" is the channel the video is uploaded into, the title and the description.
        4. Consider using a Video Portal as the content is stored in Azure instead of SharePoint and distributed as a CDN.
        5. Never store videos as attachments. Add a link in the task or announcement to a video in a library or Video Portal.

         

        Office 365 Notes

        Rule #1 for Office 365, like the weather in Cincinnati, if you don't like it, hang around. It will change. Anything written here about Office 365 is subject to change.

        The Video Portal is not a pure SharePoint environment.

        • The videos are not stored in SharePoint libraries. They are stored in Azure
        • You cannot create views, add columns or customize the metadata. The only properties are the title and the description.
        • Searching for videos in SharePoint will find videos in the Video Portal, but only by the name, filename and description.
        • Videos are played using Flash or HTML5. (Asset libraries use Silverlight!)
        • The Video Portal will probably change. (See Rule #1)

         

        Want to see more about what happens to your video file when you upload it to a Video Portal? Watch this video: https://www.youtube.com/watch?v=HXSZ0jYBKlM

         

         

        .

        5/26/2015

        SharePoint 2013 Asset Library Secrets and Wierdness!

         

        Asset Libraries are… weird. When you just upload videos using only the Upload button, and just view the videos, then all is good. But if you want the link to the video file, or you upload without the Upload button, or you want to search for all videos, then weirdness happens! Especially in Office 365 / SharePoint Online.

        In this article:
        • Finding the URL to an Asset library video.
        • Two Three ways to upload a video, with TWO THREE different results!
        • Searching Asset Libraries.

        Finding the URL to an Asset library video

        The Asset library does a pretty good job of hiding the full URL to a video file. A "video asset" item is actually a folder. The folder contains the video and supporting files like preview thumbnails.

        So, if you upload a video named butterfly.wmv to http://yourSite/sites/demo/Assets the path to the video would be http://yourSite/sites/demo/Assets/butterfly/butterfly.wmv. If you changed the Name property while uploading the file to "Pretty bugs" the URL would then be http://yourSite/sites/demo/Assets/Pretty%20Bugs/butterfly.wmv.




        There are two ways to discover the "real" URL, mouse over a download link or use SharePoint Designer.

        Mouse over:
        1. In SharePoint 2013, click the video to display the VideoPlayerPage.aspx page.
        2. Mouse over the DOWNLOAD link and right-click and select Properties.
        3. Copy the Address (URL), paste into Notepad and "un-escape" the SourceUrl parameter. (Not fun!)
         
        SharePoint Designer:
        1. Launch SharePoint Designer and open your site.
        2. In the Navigation area click "All Files". (If you don't see All Files then your administrators may have partially locked down SPD.)
        3. In the list of files and folders click the Assets library.
        4. Find and click your video (you will see the "Name" as entered in the file's properties during upload, not the file name.)
        5. Find the video file, right-click it and click Properties.
        6. Copy the Location.
        If you just want to display the video in the page using a Media Web Part:
        1. Edit the page.
        2. Click INSERT.
        3. Click Web Part.
        4. From the Media and Content category select Media Web Part and click Add.
        5. Edit the web part (click the web part's dropdown).
        6. From the MEDIA ribbon click Change Media.
        7. Click From SharePoint and navigate to your assets library and pick a video.
         

        Two Three ways to upload a video, with TWO THREE different results!

        Uploading a file to a library is just uploading a file, right?
        The Upload Button
        Click the Upload button and the video will be uploaded as a full featured "Asset Library Video"!  A folder will be created with the "Name" entered by the user and the video will be stored in that folder with the original file name.


        (I didn't have Silverlight loaded on the test workstation.)
         
        The Upload Button (with a duplicate file!)
        Here again, Office 365 is different than On Premise. With 365 if you upload the same file again, using the Upload button, you won't get a "Duplicate" error, it will just upload the file as an ordinary library file, but with a default Content Type of "Video Rendition". BUT… click OK and the file disappears! No error messages, just no file in the library! (Best guess… there was a server side error when trying to create the duplicate folder and no error was returned to the user.) With On Premise the upload just seems to freeze and never completes.
         

        Drag and Drop (Office 365 / SharePoint Online only!)
        Note: This is only a problem in Office 365!
        Drag a video from Windows Explorer onto the Asset Library page and you will get a "plain old library file" with the Content Type set to "Image". (Image is the default Content Type.)
        • If you edit the properties of the file you can only change the Content Type to "Image" or "Audio".
        • SharePoint does not stop and ask for any metadata and simply uploads the file and assigns the "Image" Content Type.
        • There is no folder created.
        • Clicking this video only displays its properties. The link there only offers to download it, not display it in the browser.

        You can actually upload the same video twice, once as an Asset Library Video and once as a "plain old library file". Remember that the Asset Library Video is really a folder.
         
         
         

        Searching Asset Libraries

        If you search an asset library by file extension you will not find any Asset Library Videos. You will only file the "plain old library file" videos that were uploaded using Office 365 drag and drop. The examples below are from the library's search box, but you get the same results from the site search box or the Enterprise Search Center.

           
          
        Search by file extension will find other file types uploaded to the Asset library:
           
          
        Best way to search? Cover all of the bases! Use the Videos vertical in the Enterprise Search Center or the following search (borrowed from the Local Videos result source).

        searchKeywordsHere
        AND
        (
         ContentTypeId:0x0120D520A808* 
         OR ContentTypeId:0x010100F3754F12A9B6490D9622A01FE9D8F012* 
         OR (
             SecondaryFileExtension=wmv OR 
             SecondaryFileExtension=avi OR 
             SecondaryFileExtension=mpg OR 
             SecondaryFileExtension=asf OR 
             SecondaryFileExtension=mp4 OR 
             SecondaryFileExtension=ogg OR 
             SecondaryFileExtension=ogv OR 
             SecondaryFileExtension=webm OR 
             SecondaryFileExtension=mov
            )
        )
        The first content type for "Video" as found in the Asset libraries. The second content type is for the Office 365 Video Portal videos. The "*" is added to include any content types you create that inherit from these two.


        Takeaways



        • In an Asset library there are "videos" and "Asset Library Videos". Which you get depends on how you upload them.
        • "Asset Library Videos" files are well hidden in a folder and their true URLs can only be discovered using SharePoint Designer, PowerShell, code or from the "DOWNLOAD" link in the videoplayerpage.aspx page.
        • Searching for videos where the videos could be in a library, an Asset Library or an Office 365 Video Portal is best done using the "Videos" vertical in the Enterprise Search Center.


        .

        Note to spammers!

        Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.