SharePoint – Add HTML Formatting to Page

Problem: Want to add styling to a SharePoint page in a team site.

Solution: Add an HTML Form webpart and add the HTML, or add a Content Editor webpart and add HTML.  Add a Script Editor webpart that holds the styling.

 

Advertisements

SharePoint – [Today] to include Time in Filter View

Problem: You have a SharePoint List.  You want a view of the list that filters items based on a time not aligned with the 24-hour “Today” time period.  For example, you want to see items created between 10:00am yesterday and 9:59am today.

Solution:

  1. Create a new column in the list for “EndDate”
  2. Create a workflow
    • set the time 10:00am for “Today” as the variable “Start Time”
    • add 1 day to “Today” and set that day to the variable “Today Plus One”
    • set the time 9:59am for the variable “Today Plus One” and assign to the variable “Todays End Date”
    • Set the “EndDate” column created in step one to “Today’s End Date”
  3. Create a view that filters the data to only show items where “EndDate” is greater than Today.
  4. Edit the view in SPD to include Time: <Value Type=”DateTime” IncludeTimeValue=”True”>

 

SharePoint 2013 Crawled property names

The names of SharePoint crawled properties are not always easily read or understood.  Here are few tips that helped me out a lot once I learned them:

  • ​List Columns = ows_ColumnName
  • Site Columns = ows_q_<4 letter code that maps to the data type>_Column Name
  • Managed Metadata = ows_taxId_ColumnName
  • HTML or Multiline Text = ows_r_<4 letter code that maps to the data type>_Column Name

 

SharePoint 2013 Search Results Query Not Working

Problem: You add a Search Results webpart to a page and using the query builder configure the results to retrieve and the format in which to sort or filter them.  In the preview on the query builder the query appears to be returning the correct results, in the sorted format desired, but when you save and close the page the results are not sorting.

Solution: Create a Result Source on the site collection that has the same query.  Then go to the page with the Search Results webpart and in the query builder choose the newly created Result Source where you “Select a query”.  Save and close the page and the query should now return the expected results in the sorting format desired.

SharePoint 2013 KQL for Sites User has Access

Problem: You want a webpage on your SharePoint intranet that lists only the sites the logged-in user has permissions to access.

Solution: Create a page, insert a search results webpart with a query that uses KQL.  The notes for each KQL statement were key to getting the results to show as desired.

  • KQL for websites = ContentClass:STS_Web
    note: this will return SharePoint sub-sites so they show independent of their parent sites
  • KQL for site collections = ContentClass:STS_Site
    note: this will return only the root SharePoint sites