Showing posts with label SharePoint Site Owner. Show all posts
Showing posts with label SharePoint Site Owner. Show all posts

10/23/2015

SharePoint: Set a Calculated Hyperlink Column from a Workflow

The following applies to SP 2010 and SP 2013 and should work in SP 2007.

You want a calculated column for a hyperlink, but can't create one. (you can't embed working HTML into the calculation.) So… you consider a workflow to create the data for a hyperlink column.

Some things in SharePoint are obvious, while others are not. Setting a calculated hyperlink field to a new URL from a workflow is one of the not so obvious. When you use the "Update List Item" action, click "this list", click Add and the "…" you get an Edit Hyperlink dialog box. While you can type manual text and URL entries, you can't build an expression. Your second choice is to click fx set a value from a variable. The problem is that this is not a simple string. The string in the variable needs to match this pattern, which includes a comma and one space:
    http://yoururl, your display text

 

Assumptions for the walkthrough:

  • You have a list with a course ID column named ID.
  • You have a course title column named Title.
  • You have an empty Hyperlink column named TheLink.

 

Steps:

  1. Open your site in SharePoint Designer 2010 or 2013 as appropriate.
  2. Click Lists and Libraries and click your list.
  3. Click the List Workflow button in the ribbon.
  4. Name your workflow and in SPD 2013 set the Platform Type to SharePoint 2010 or 2013 as desired..
  5. Click OK.
  6. Click the Action dropdown and click Set Workflow Variable.
    image
  7. Click workflow variable and create a new variable with a name like "LinkText", set the Type to String and click OK.
    image
  8. Click value and click the "" button.
  9. Create a string that will build your URL and your description, separated by a comma and a space. Click Add or Change Lookup to insert data from other columns. Then click OK.
    image
  10. Click the Action dropdown and click Update List Item. (for 2013: Set Field in Current Item)
    image
  11. Click this item, click Add, and select your hyperlink column. (for 2013: Click field and pick your hyperlink column and then click value and pick your variable.)
    image
  12. Click the fx button, select Workflow Variables and Parameters and then select your variable and click OK.
    image
  13. Click OK.
  14. Click Publish (in the ribbon).
  15. Test the workflow.
    1. Return to your list.
    2. Checkmark a list item.
    3. Click the ITEMS tab and click Workflows.
    4. Click the name of your workflow and click Start.
    5. Click the URL column and confirm that the link works.
  16. You will probably want to return to Designer and change the Workflow Settings to start the workflow when an item is created and when an item is changed.

 

 

.

10/15/2015

SharePoint: Two Secrets for Typing Two Letter Names

 

SharePoint 2013 took away the people picker search tool and replaced it with an autocomplete feature. Type a few letters and matching names appear.

image

The problem is that this only works when you have typed the third letter of the name. With only two letters SharePoint just sits there patiently and does nothing useful.

image

 

But there is a way…

Two secrets for two letter names...

  • Type the two letters and a space. Name will pop up.
  • Type the two letters and a semicolon. Name will be auto completed.

 

The semicolon trick also works when you have typed enough to uniquely identify a single user or group. In my farm I only have one "Robert". Typing "rob;" automatically finds him. Typing "sale;" finds and adds the "Sales" AD group.

 

 

 

.

10/14/2015

SharePoint Online… Where's My Tree View?

 

As you are probably aware by now… SharePoint Online is a member of the "change of the day" club. My Tree View is missing in my online sites!

In my on-premises SharePoint 2013 I can go to Settings, Site Settings and there turn on/off the Tree View navigation control.

image

 

On-line? No Tree View for me…   Oh, there it is…. Navigation Elements.

image

 

What's a "Navigation Element" anyway? If I had to rename it, I would have called it "Quick View or Tree View".

 

This is great fun for people like me who write courseware for SharePoint.   Sad smile

 

Another day… another change…………………………………

 

 

 

.

10/08/2015

SharePoint Column Validation Examples

Update 11/2/2015… added "Date must be the first day of the month" and "Date must be the last day of the month".
The following applies to SharePoint 2007, 2010 and 2013.

Column Validation

SharePoint does not include column types for phone numbers or part numbers, nor does it include support for Regular Expressions to test for character patterns. It does support Excel style functions that we can use to create useful column validation formulas.
Below you will find column validation examples for:
  • OR
  • AND
  • Length (LEN)
  • Pattern matching using SEARCH and FIND
  • Date testing

General Validation Formula Rules:

  • Formula must return True or False.
  • Column validations can only be added to Single Line of Text, Number, Choice (Drop-Down menu or Radio buttons, but not Checkboxes), Currency and Date and Time columns.
  • Expressions are generally Excel compatible, but not all Excel functions can be used.
  • Field names without special symbols can be entered as is or in square brackets
          = Price * [Qty]  > 100
  • Field namess with spaces or symbols must be enclosed in square brackets
          =OR( [Sales Region] = 1, [Sales Region] = 1)
  • The text comparisons are not case sensitive.
          =OR( status = "a", status="c")     is true for either "A" or "a" or "C" or "c".
  • In a column validation the formula cannot refer to another column.
  • In a list / library validation the formula can refer to other columns in the same item.

Examples using "OR":

The OR function accepts two or more Boolean tests that each return True or False. OR returns True if any one of the tests is True.
=OR(YourFieldName="A",YourFieldName="C",YourFieldName="E")
=OR(State="OH", State="IN", State="KY", State="MI")
=OR(Qty=5, Qty=10, Qty=20)

Examples using "AND":

The AND function accepts two or more Boolean tests that each return True or False. AND returns True if all of the tests are True.
=AND(YourFieldName>"A", YourFieldName<"M")     YourFieldName value must be between A and M.
=AND(Qty>5, Qty<100, Qty<>47)      Qty must be between 5 and 100, but not 47.

Examples using "LEN":

As an example, if your part numbers are always 9 characters long:
    =LEN(YourFieldName) = 9
If the part numbers can be 9 or 12 characters long:
    =OR( LEN(YourFieldName) = 9, LEN(YourFieldName) = 12 )

Examples for Pattern Matching

The SEARCH function:  (online help)
  • Matches a pattern using "*" and "?". "*" equals zero more characters and "?" equals exactly one character.
  • To match an asterisks or question mark character prefix the symbols with "~". 
    Example: "a~?b?c" matches "a?bxc" but not "axbxc". 
  • An "*" is assumed to be appended to the end of the match pattern. To limit the length use the AND and LEN functions.
  • The comparison is not case sensitive.
  • If there is a match, the function returns the position of the match. If the every character is to be matched you would typically test for "=1" or maybe ">0". 
  • If there is no match, the function returns ERROR, therefore it must be wrapped inside of an ISERROR function. As we will have a match if there is no error, the ISERROR must be wrapped inside of a NOT function. (online help for ISERROR)
Examples:
Must start with an "a" or "A" and the third character must be a "c" or "C":
   =NOT(ISERROR( SEARCH("A?C",YourFieldName)=1 ))
   Matches: abc   AbC  aXc  a6c aBcDEF
   Does not match:   bbb   abb  ac  a
Match a phone number pattern of xxx-xxx-xxxx: (note: user could type letters or digits or type extra characters.)
   =NOT(ISERROR( SEARCH("???-???-????",YourFieldName)=1 ))
   Matches: 123-123-1234    aaa-aaa-aaaa   123-123-12344444
Match a phone number pattern of xxx-xxx-xxxx and limit the length:
   =AND( NOT(ISERROR(SEARCH("???-???-????",YourFieldName,1))), LEN(YourFieldName)=12 )
   Matches: 123-123-1234
   Does not match: 123-123-12345

Match a phone number and make sure only digits have been used:
The first example here is not a true pattern match. It just extracts the characters we think should be digits and tries to multiply them by any number. If that fails, then one or more of the characters is not a number. (online help for CONCATENATE and MID)
=NOT(ISERROR(1*CONCATENATE(MID(YourFieldName,1,3),MID(YourFieldName,5,3),MID(YourFieldName,9,4))))
   Matches: 123-123-1234    123x123x1234   123-123-1234xxxxx
   Does not match: abc-123-1234
The second example combines the earlier pattern match with a numeric test:
   =AND(NOT(ISERROR(SEARCH("???-???-????",YourFieldName,1))),LEN(YourFieldName)=12, NOT(ISERROR(1*CONCATENATE(MID(YourFieldName,1,3),MID(YourFieldName,5,3),MID(YourFieldName,9,4)))))

The FIND Function:  (online help)
The FIND function is similar to the SEARCH function with two differences;
  • FIND is case sensitive.
  • FIND does not support wild cards.

Examples Using Dates

You can create rules to limit date ranges by using the TODAY() function or the DATEVALUE() function.
Date must be in the future:
    =YourFieldName>TODAY()
Date must be in the future by "x" days:
    =YourFieldName>TODAY() + 3I.e. If today is the 7th, then valid dates start on the 11th.
Test against a particular date:  (online help for DATEVALUE)
    =YourFieldName>datevalue("1/1/2015")
Date must be between now and the end of the current year:  (online help for YEAR)
    =YourFieldName < DATEVALUE( "12/31/" & YEAR(TODAY()) )This example calculates a DATEVALUE by building a string to represent a future date.
Date must be within the next 30 days:
    =AND(YourFieldName >= TODAY(),YourFieldName <= TODAY()+30)
Date must be a Monday:   (1 = Sunday, 2 = Monday, 3 = Tuesday, …)   (online help for WEEKDAY)
    =WEEKDAY(YourFieldName)=2
Date must be the last day of the month:
=DATE(YEAR(yourDateColumn),MONTH(yourDateColumn),DAY(yourDateColumn))=DATE(YEAR(yourDateColumn),MONTH(yourDateColumn)+1,0)
Date must be the first day of the month:
=DATE(YEAR(yourDateColumn),MONTH(yourDateColumn),DAY(yourDateColumn))=DATE(YEAR(yourDateColumn),MONTH(yourDateColumn),1)
Note: Some of the more "fun" Excel date functions like WEEKNUM, NETWORKDAYS and EOMONTH are not supported in SharePoint.

Not so useful tests!   Smile

Value must be greater than PI.  (3.14159265358979 more or less…)
    =YourFieldName > PI()
And some square roots:
    =YourFieldName > SQRT(2)
And of course you need a little trig:
    =TAN(RADIANS(YourFieldName)) > 1

.

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

 

.

8/07/2015

Hiding the Evil SharePoint 2013 Share Buttons!

 

SharePoint introduced Share buttons to make it easy for users to quickly share a site, folder or document. This introduced several administration, security and governance problems for administrators. Mostly because the act of sharing a document breaks inheritance on the file. Whether this is "evil" or not depends on the way you need to use SharePoint. 

Here's a sample flow:

  • We have a library for 100 sales documents. Currently the Sales Managers group and five other users have access to the library and its contents.
  • Someone clicks the Share button on a document.
    • If the user is not an owner and does not have the Manage Lists permission, then a request is added to the Site Owners. Site Owners, if they ever discover the request, can approve or reject it.
  • Inheritance is broken on the document. Existing permissions are copied to the file. The user is added to the document's permissions list.
  • Now the fun begins…
    • A new user or group is given permissions to the library.
    • They only see 99 documents! (The missing document has unique permissions and no longer inherits permissions from the library.)

After inheritance is broken you have to remember to manage the permissions of each individual broken inheritance document. Now think about 50 libraries, each with where the Share button has been clicked on a 1000 documents. Job security at the minimum!

 

Just how many Share buttons are there?  
(Let me count the ways…)

The Share the site button:

   image

The Share a document button in the "QCB" (Quick Control Block?) bar:

   image

The Share a document button in the FILES ribbon :

   image

The Share a document button in the "…" pop out:

   image

The Share a document link in the "… …" menu:

   image

The INVITE PEOPLE button in create a new folder:

   image

The Invite People button in the Shared With dialog box:

   image

Did I miss any?

(I started on this article a few times, but each time I found yet another Share button!)

 

Disabling using Views

You can hide the Share button that's just above the library by switching to any other view style than"Default". This also hides all of the other links in the "QCB" (Quick Control Block?) bar.

image

The Share button will be grayed out in the FILE ribbon if you select a Style other than Default and Shaded, or disable "Tabular View - Allow individual item checkboxes".

Disadvantages? These styles do not display a checkbox, even if "Tabular View - Allow individual item checkboxes" is checked. Without the checkbox most of the options in the FILE ribbon are disabled.And… this approach only hides one of the Share buttons.

 

Disabling the Share buttons using CSS

The easiest way, at least until Microsoft gives us an option to turn them off, is to add CSS to the Master Page. Some of the buttons has convenient IDs while some can be found using a class. While you could merge all of the selectors into one line, I broke them out so you could choose which Share features you would like to hide or keep.

In my project I uploaded the CSS file to the Site Assets library. You could place the CSS file in any library where your users have at least read access, or in the layouts folder on the server. You would then link to the file something like this:

<link rel="stylesheet" type="text/css" 
href="https://yourServer/sites/yourSite/SiteAssets/nosharebuttons.css"></link>

Or maybe:

<link rel="stylesheet" type="text/css" href="/_layouts/nosharebuttons.css"></link>

 

The CSS:

/* CSS to hide the various Share buttons and links */
/* from TechTrainingNotes.blogspot.com             */
/* Use at your own risk. Batteries not included.   */

/* Hide Site Share button (page top right) */
#ctl00_site_share_button  {
 display:none !important;
}

/* Hide library toolbar (QCB) Share button */
.js-listview-qcbShareButton {
 display:none !important;
}

/* Hide the Share in the ... popout */
.js-callout-actionsMain span:nth-child(2) {
    display:none !important;
}


/* Hide the Share in the ... ... menu */
a[title="Share"] {
 display:none !important;
}


/* Hide the INVITE PEOPLE button in Create Folder */
#csfd_invitePeopleBtn {
 display:none !important;
}

/* Hide the Share button in the FILES ribbon */
#Ribbon\.Documents\.Share\.ShareItem-Large {
 display:none !important;
}

/* Hide the Invite People button in the Shared With dialog */
#lnkShrItem {
 display:none !important;
}

 

Here's the "one line" version:

/* CSS to hide the various Share buttons and links */
/* from TechTrainingNotes.blogspot.com             */
/* Use at your own risk. Batteries not included.   */


#ctl00_site_share_button, 
  .js-listview-qcbShareButton, 
  .js-callout-actionsMain span:nth-child(2), 
  a[title="Share"], 
  #csfd_invitePeopleBtn, 
  #Ribbon\.Documents\.Share\.ShareItem-Large, 
  #lnkShrItem 
{
 display:none !important;
}

 

.

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/09/2015

SharePoint 2013: Hide List and Library Column Headings

 

This is an update to an older article to include support for SharePoint 2013.


Hiding Column Headings

I had a request to hide the column headings of a list displayed in a web part. First thought was that they wanted to hide the toolbar, but they were asking about the clickable column headings. I think they were wanting to make a page look more like a regular web page instead a page full of lists. By the way, this makes for a better way to display a view with only one column.

Note: This will of course remove the ability of the site visitor to sort and filter the web part.

Note: This will also work in the view page (view pages use web parts!), but in SharePoint 2010 and 2013 adding a web part to a view page will change how the ribbon gets displayed and will remove the View dropdown menu from the title area crumb trail.

Before:

image

After:

image

With Toolbar set to "No Toolbar":

image

Remove additional clutter…

You can edit the web part and then click "Edit the current view" further clean up the display of the list.

  • Remove the checkbox column: In the Tabular View section uncheck "Allow individual item checkboxes".
  • Remove the "…": In the Columns section uncheck "Name (linked to document with edit menu)" and checkmark "Name (linked to document)".
  • Remove the hyperlink: In the Columns section uncheck "Name (linked to document with edit menu)" and checkmark "Name (for use in forms)".
  • Remove any unneeded columns such as Modified or Modified By.

image

 

Steps:

  • Add your web part for the list or library to a page.
  • For a minimal look set the web part's Toolbar Type property to “No Toolbar”.
  • Copy the JavaScript below to a Notepad file (name it something like “HideHeading.html”) and upload this file to a library such as Site Assets.
  • In the library where you uploaded this file, click the "…" and copy the displayed URL. It should look something like this:
        https://yourServerDomain/sites/training/SiteAssets/HideColumnHeadings.html
  • Below your list / library web part add a Content Editor Web Part (CEWP).
    • If the CEWP displays it’s title bar then in the Appearance section set the Chrome to “none”.
    • Paste the URL copied above into the Content Link box.
    • In the web part properties editor, click OK.
    • In the PAGE ribbon, click Save.
  • Or (for SharePoint view pages)
    • Edit the view page in SharePoint Designer 2013. 
    • Copy and paste the Javascript to just before the end tag for PlaceHolderMain (just before </asp:Content>).
  • If you want to hide the column headings of multiple web parts modify the IF statement like this Three web parts

Web part summary name!

In SharePoint 2007, the summary name is usually just the list’s name: “Shared Documents”.

In SharePoint 2010, the summary name is usually the list’s name PLUS the list’s description. For example the default for Shared Documents is: “Shared Documents Share a document with the team by adding it to this document library.”  (including the period)

To find the correct name use your browser’s View Source option to display the HTML of the page and search for “summary=” and copy the text that follows. Or, use the browser's developer tools (usually F12) and search for "summary="

    <table  …  summary="Shared Documents Share a document with the team by adding it to this document library."   … >

 

The JavaScript

Need to change multiple web parts? Edit the line that contains "if (x[i].summary==""

Two web parts:
             if (x[i].summary=="Tasks" | x[i].summary=="Shared Documents"
Three web parts:
             if (x[i].summary=="Tasks" | x[i].summary=="Links" | x[i].summary=="Shared Documents"

<script type="text/javascript">
// CEWP trick from techtrainingnotes.blogspot.com!

// techtrainingnotes.blogspot.com/2015/07/sharepoint-hide-list-and-library-column.html
// Hide column headings in web parts

function TTNHideHeadings()
{
  //Find the list  (change "Documents" to your web part's "summary" name)
  var x = document.getElementsByTagName("TABLE"); // find all of the Tables 
  var y;
  for (var i=0;i<x.length;i++) 
  {
    if (x[i].summary=="Documents")  //find the table with this name
    {
      y = x[i].getElementsByTagName("TR");
      y[0].style.display="none";  //hide the first row
    } 
  }
}

try {
  // for 2010 and 2013
  ExecuteOrDelayUntilScriptLoaded( TTNHideHeadings, "sp.js" );
}
catch (e) {
  // for 2007
  _spBodyOnLoadFunctionNames.push('TTNHideHeadings');
}
  
</script>

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/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

 

 

.

SharePoint 2013: Create a Quote of the Day Web Part (a CEWP trick!)

(Updated 11/24/17 to allow use in a Publishing page.)

This is a 2013 version of the 2007 and 2010 article found here: http://techtrainingnotes.blogspot.com/2010/10/sharepoint-create-quote-of-day-web-part.html


Quote of the Day / Tip of the Day

Want to display some “wise words” for your coworkers? You need a Quote of the Day web part!

image

You could display a picture or product of the day:

image


This web part is another simple Content Query Web Part solution similar to the ones found in my SharePoint 2010 Customization book. But… this one is for 2013!

  • Works from a normal SharePoint list.
  • Displays a random quote from the list.
  • Can display a new quote on each page view, or just one new quote a day.
  • Can be used to display quotes, product announcements or any kind of text, pictures or other content that you can add to a SharePoint rich text editor column.


Create the Quotes list

While you could use a Custom List, I used an Announcements list as it already had what I needed, a Title field and a Rich Text field.

  1. Go to Settings (gear) and click Add an App.
  2. Find and click Announcements.
  3. Add a name for the list such as “Quotes”.
  4. The description is optional, but is best left blank as it adds a little complication later on.  (I.e., don't click Advanced Options and add a description!)
  5. Click Create.
  6. If you are not using the Announcements list type then from the list’s Settings menu click Create Column and add a “Multiple Lines of Text” column. Name the column “Quote” (although any name will work) and click “Rich text (Bold, italics, text alignment).
  7. Add a few quotes by clicking "new announcement" or New from the ITEMs ribbon. You can use all of the rich text formatting options if you like. (Bold, colors, etc.)
  8. Create a new view by clicking the Create View link in the LIST ribbon.
  9. Create the view as a Standard view and name it something like “QuoteView”. Un-checkmark all columns except for “Quote” column (the “Body” column if using an announcements list).
  10. Expand the Tabular View section (scroll down to find it) and uncheck "Allow individual item checkboxes".
  11. Click OK.

You now have the list that will store the quotes. You will now add two web parts to a page. One which is the list of quotes, and the other which is a Content Editor Web Part with the JavaScript and HTML code.


Add the Quotes list web part to the page

  1. Go to the page where you want to add the “Quote of the Day”, most likely your home page. 
  2. Click Settings (gear), Edit Page.
  3. Click where you would like to add the quotes.
  4. In the INSERT ribbon click Web Part and add the web part for the quotes list.
  5. In the web part click dropdown arrow and then Edit Web Part.
  6. Select the view you created above (“QuoteView”).
  7. Click OK.

This web part will be hidden when the JavaScript runs.


The JavaScript and HTML file

  1. Open Notepad or your favorite HTML editor.
  2. Copy the sample code from below and paste into your editor.
  3. Either delete my sample <style> block (it displays the quote in red) or customize your own style.
  4. Find the line with "var quotesWebPartName=" and change "Quotes" to your list's name.
  5. (Optional) Find the line with "var OneQuotePerVisit = false" and change it to true so the user can only see one quote per day.
  6. Save the file.
  7. Upload the file to a library where all of your users have at least Read or View access. "Site Assets" is a good choice.
  8. Find the URL of the uploaded file by clicking the "…" next to the file name. Copy the URL so we can paste it into the CEWP below.


The Content Editor Web Part

  1. Add a Content Editor Web Part (CEWP) and move it so it is near the quotes web part. While the list web part can go anywhere, the CEWP must go where you would like to display the quote of the day. 
  2. Click the CEWP’s dropdown menu and select Edit Web Part.
  3. Paste the URL you copied earlier into the Content Link box.
  4. In the Appearance section add a title for the web part (perhaps “Quote of the Day”).
  5. At the bottom of the web part properties box click OK.
  6. Save your page and test! Refresh the page to see if the quote changes.



The JavaScript

Copy and paste the following JavaScript into Notepad or your favorite HTML editor. (see above)

<!-- add your own formatting here... (optional)-->
<style type='text/css'>
  #TTNQuoteText { color:red }
</style>


<!-- Quote will be displayed here -->
<span id="TTNQuoteText"></span>



<script type="text/javascript">

function TTNShowQuote()
{
// another CEWP trick from http://TechTrainingNotes.blogspot.com
// http://techtrainingnotes.blogspot.com/2010/10/sharepoint-create-quote-of-day-web-part.html

// name of the quotes library web part
  var quotesWebPartName="Quotes"; 


// set this to "true" so the user will see the same quote 
// for 12 hours or until they close and reopen the browser
  var OneQuotePerVisit = false;



// don't change these
  var QuoteList;
  var QuoteArray = [];
  var quoteCount = 0;

  var TTNTables = document.getElementsByTagName("TABLE");
  var i=0;
  for (i=0;i<TTNTables.length;i++) 
  {
    if (TTNTables[i].summary)
    {
    if (TTNTables[i].summary == quotesWebPartName)
    {
      // Get the table with the quotes
      QuoteList = TTNTables[i].getElementsByTagName("tbody")[0];

      // hide the links list web part, but only if not in edit mode
// 11/25/17 update to allow use in a Publishing page.
if ( typeof PageState == 'undefined' || (PageState.ViewModeIsEdit != "1") )
{ QuoteList.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display="none"; } break; } } } if (!QuoteList) { document.getElementById("TTNQuoteText").innerHTML="Web Part '" + quotesWebPartName + "' not found!"; } //Count the quotes var links = QuoteList.getElementsByTagName("TR") // find all of the rows var url; var quoteCount = 0; for (i=0;i<links.length;i++) { //if (links[i].childNodes[0].className=="ms-vb2") //{ QuoteArray[quoteCount] = i; quoteCount++; //} } if (quoteCount==0) { document.getElementById("TTNQuoteText").innerHTML="No quotes found in web part '" + quotesWebPartName + "'!"; } var id=-1; // check for a cookie and use last ID if found if (OneQuotePerVisit) { // check for a cookie with the last quote ID if (document.cookie.length>0) { c_start=document.cookie.indexOf("LastQuoteDisplayedID="); if (c_start!=-1) { c_start=c_start + "LastQuoteDisplayedID".length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; id = unescape(document.cookie.substring(c_start,c_end)); } } } if (id == -1) { // generate a random quote ID id = Math.floor(Math.random() * QuoteArray.length) } // display the quote document.getElementById("TTNQuoteText").innerHTML= QuoteList.getElementsByTagName("TR")[QuoteArray[id]].childNodes[0].childNodes[0].childNodes[0].innerHTML; if (OneQuotePerVisit) { // set a cookie so they see the same quote for xx hours (.5 = 1/2 day = 12 hours) var exdate = new Date(); exdate.setDate(exdate.getDate() + 1); document.cookie="LastQuoteDisplayedID=" + id //+ ";expires=" + exdate.toUTCString(); } } // add our function to the SharePoint OnLoad event _spBodyOnLoadFunctionNames.push("TTNShowQuote"); </script>


Only have about 100 more of these to update from 2007/2010 to 2013!



.

3/15/2015

Word Stemming in SharePoint 2013 Search

 

Word Stemming

Word stemming is when a search engine resolves a word to its root form and then returns variations of the word.

For example, search for one of these and return the rest:

  • run, ran runner, running, runs
  • fish, fishes, fisher, fishing

 

SharePoint 2013 Word Stemming

SharePoint 2013 only does "stemming" on singulars and plurals. So all we get for "run" is "runs" and for "fish" is "fishes". The exact stemming depends on the language.

SharePoint 2007 and 2010 did support an expanded form of word stemming, but you had to enable it in the search results web parts.

 

So what do we do?

Search using "OR".

   fish OR fishing OR fisher

   run OR ran OR running OR runs

Remember that the Boolean operators like "OR" must be typed in upper case and that mixtures of AND and OR usually will need parentheses.

   race AND (run OR ran OR running OR runs)

 

oh well…

 

.

3/06/2015

SharePoint 2013: Missing Search Box

 

You have a search box over your list or library and I don't! Why?

SharePoint 2013 has added a search box to most lists and libraries that is scoped to the current list. When the user performs the search they will stay in the list’s page. They will not be redirected to a search results page. They can continue to sort or filter the results using the column heading dropdowns.

    image

Pretty cool! But it's missing in my library!

 

Four Reasons You Might Not See It

#1 - Turns out that this search box is only available in one View Style. If you have not played with View Styles then take a look at this article http://techtrainingnotes.blogspot.com/2010/05/sharepoint-list-view-styles.html That's an older article, but still applies to SharePoint 2013.

If you pick any style other than Default, you lose the search box. Bummer…

    image

#2 -  It's only available in the Enterprise Edition of SharePoint 2013. I'm guessing that it may only be available in Office 365 / SharePoint Online in the "E" subscriptions.

#3 -  It can be disabled! Edit the page, edit the web part, expand the Miscellaneous section: It is enabled by default in list/library pages. It is disabled by default when you add a list/library web part to a page.
     image

#4 - It is only displayed when server side rendering is disabled.
     image.

.

3/03/2015

SharePoint 2013 Search Spelling Suggestions Confusion?

 

Over the last three months I have been working on a Search Administration class that has a focus on improving the end user search experience. If you have attended one of my governance classes or consulting sessions then you have heard me preach on the need for a "Search Administrator". If you are interested in this area of administration then check out my new class: Microsoft SharePoint 2013 Search Administration. The next class is 3/11/15!

SharePoint 2013 search is not always well documented. As an example, read the description of Search Spelling Suggestions here: https://technet.microsoft.com/en-us/library/jj591607.aspx While very factual, it just does not tell me enough…

So off to the blogs…

First problem is that it seems a lot of people mix up Search Query Suggestions and Search Spelling Suggestions. They are not the same! Query Suggestions are offered while the user types in the search box. Spelling Suggestions are offered only in the search results pages, after the user executes the search.

A Spelling Suggestion:

image

(“corydoras” is kind of catfish. Smile)

 

Second problem? It seems due to the lack of extensive documentation that a lot of people are guessing.

  • One blog says that "only the first level of Terms is taken into account".
  • One even said that spelling suggestions could be used to map between terms. (Must have been thinking about Query Suggestions.)
  • Another says that while searching for a term found in the second level of a term set, and no items are found, that the parent level's term will be offered as the suggestion.
  • Some call the Query Spelling Inclusions term set the "Static" dictionary.

All of those are wrong.

 

Here's what my trial and error has found:

  • There are four sources for spelling suggestions:
    • The default static spelling dictionaries (static out of the box dictionaries).
    • The default dynamic spelling dictionary (dynamically generated from your content). This is also called a "content-aligned spelling dictionary".
    • The Query Spelling Inclusions term set (manually entered).
    • The Query Spelling Exclusions term set (manually entered).
  • Spelling suggestions are based on the closest matches in the default spelling dictionaries and the Query Spelling Inclusions list. Only one suggestion will be displayed. It appears that a phonic / sound alike match is being used, so the properly spelled and misspelled words must be similar in length and pattern.
  • You can’t edit the default static or dynamic spelling dictionaries.
  • Static dictionaries
    • The static dictionary is a canned list of words. (Something like the Word dictionaries.)
    • The user can change the language dropdown and see words from another language.
  • Dynamically created dictionaries
    • The dynamic dictionary is created by search as content is indexed. I.e. it's based on words commonly found in your content.
    • The user can change the language dropdown, but this does not change offered words (at least from my testing).
    • Support for dynamically created dictionaries depends on the language. See https://technet.microsoft.com/en-us/library/jj219499.aspx
    • For dynamic spelling correction to work, you should have at least several thousand medium-sized documents. The default settings require that a word occur in at least 1000 documents to be included in the dictionary.
    • The dynamic dictionary is updated once a night and can be a long running process. (The default timeout is 6 hours!)
  • Query Spelling Inclusions / Exclusions
    • You must have a configured Managed Metadata Service.
    • The terms must be added to the auto-created Query Spelling Inclusions term set.
    • You manually enter a list of words into an include or exclude list of terms.
    • You can only include single words, not phrases in the term sets.
    • While sub-terms can be entered, they are treated no differently than top level terms. (Some documentation says they are ignored.) Some documentation says terms at the same sublevel can be used as “Do you mean”, but testing does not show this.
    • It may take ten minutes or more for updates to the term sets to show up in search results. (Search Custom Dictionaries Update timer job)

As there are a number of articles about adding words to the Query Spelling Inclusions term set using Managed Metadata Services, code and PowerShell, I will not cover that here.


 

What about the options available in the PowerShell commands?

There are two PowerShell cmdlets that can be used to manage the on premises SharePoint's spelling options. Again the TechNet article is factual, but not too clear on the Static vs. Dynamic topic.

    Get-SPEnterpriseSearchQuerySpellingCorrection
    Set-SPEnterpriseSearchQuerySpellingCorrection

Note: These cmdlets are currently only for on premises SharePoint. It looks like Office 365 is set to use the Dynamic dictionary.

You can see the spelling suggestion options using:

    $ssa = Get-SPEnterpriseSearchServiceApplication
    Get-SPEnterpriseSearchQuerySpellingCorrection -SearchApplication $ssa

    image

SpellingDictionary = Static / Dynamic

Many of the blogs state that you can choose either Static or Dynamic as the SpellingDictionary value, and that by selecting one of these you would exclude your manually entered Query Spelling Inclusions . The confusion seems to be around the definitions of the words Static and Dynamic. My testing shows that:

  Dynamic = use the list of words found in your content, plus the Query Spelling Inclusions term set

  Static = use the static built-in / out of the box dictionary, plus the Query Spelling Inclusions term set

As an example, I do not have "SharePoint" or "SharePint" in my Query Spelling Inclusions term set, but I do have "corydoras". When I do a search for "SharePint" I get the following only when SpellingDictionary is set to Static: (this word is in the canned dictionary)

    image

When searching for a term in the Query Spelling Inclusions term set like "corydoras" I get results regardless of if SpellingDictionary is set to Static or Dynamic.

    image

Why don't I get any help when SpellingDictionary is set to Dynamic and I search for "SharePint"?

    image

Take a look at the TermFrequencyThreshold property. Using the defaults SharePoint would need to find at least 1000 documents that contain the word "SharePoint". My testing sample set of documents is not quite that big. If I change it from 1000 to 20 and run the "Spelling dictionary update" timer job then I can start to get useful results from "Did you mean?" for "SharePint". (i.e. "SharePoint" was in at least 20 of my sample documents.)

    image

 

 

Note: Using PowerShell to change from Static to Dynamic, or the reverse, immediately impacts user searches.

 

Additional Links of Interest

This article, Search in SharePoint 2013 knowledge articles for Systems Center Operations Manager, hints at more details about the search spelling suggestions feature.

The spelling related timer jobs are listed in this page: Timer job reference (SharePoint 2013)

.

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.