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

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

 

.

3/15/2016

SharePoint 2013 and SharePoint Online Built-In Accounts

 

image

I’m often chasing one SharePoint rabbit or another down a rabbit hole and spending hours there when I only wanted to ask the rabbit one simple question. In this case the question was who is “Everyone” and are they related to “NT AUTHORITY\Authenticated Users”. A simple question, or so I had thought. In this rabbit hole I found all kinds of interesting accounts, so I thought that I’d take a few notes while I was there. As to “Everyone”, I’ll follow up with another blog article. I also got distracted by two Office 365 users hanging around the hole named “Guest Contributor” and “Guest Reader” that will also get their own article.

If you would like to dive into the rabbit hole, here’s a few tools to investigate user accounts:

  • PowerShell on prem: 
    $site = Get-SPSite http://yourDomain/sites/yourSite
    $site2.RootWeb.AllUsers | FT –AutoSize
  • PowerShell for Office 365:
    Get-SPOUser -Site http://yourDomain/sites/yourSite | Select DisplayName, LoginName
  • In the browser:
    • Go to Settings (gear), Site Settings, People and Groups
    • Edit the URL and change the GroupId to 0    (“?MembershipGroupId=0”)
    • Click any interesting user name. If the user has a User Profile you will probably be redirected to their profile page. If not, you will be redirected to userdisp.aspx where you can see the user name and their internal Account property as listed in the table below.
  • Third party security and auditing tools.

 

Claims Based Authentication

SharePoint 2013 and later uses Claims Based Authentication which can support more than one authentication source. This slightly complicates the UserLogin property as it must have both the user name and the claims source data in the property value. In a non-Claims system the user name might be as simple as contoso\msmith. In a Claims system you need to know where the user was authenticated, so you end up with UserLogins that might look like i:0#.w|contoso\msmith for a Windows AD user or i:0#.f|ContosoFBA|susan for a Forms Based Authentication user.

If you would like to learn more about the Claims identity codes (“c:0!.s”, etc.) see: http://social.technet.microsoft.com/wiki/contents/articles/13921.sharepoint-2013-claims-encoding-also-valuable-for-sharepoint-2010.aspx
and
http://www.wictorwilen.se/Post/How-Claims-encoding-works-in-SharePoint-2010.aspx

 

The Users

image

Who are all of these users? Well… I’m still negotiating with the rabbit for more details, but I’ll soon add these articles with what I have discovered:

  • SharePoint: All Users vs. Everyone vs. Everyone But External vs. NT AUTHORITY\AUTHENTICATED USERS
  • SharePoint Online “Guest Contributor” and “Guest Reader” - Who’s Guest Contributor,
    and what are they doing in my library?
  • SharePoint internal and hidden accounts hiding in your Site Collection

For now:

  • NT AUTHORITY\AUTHENTICATED USERS represents all of the users in your Active Directory, on prem or in the cloud.
  • Everyone at the AD level is NT AUTHORITY\AUTHENTICATED USERS plus the Guest account. The Guest is disabled both by default and as a best practice. (You don’t see this one in SharePoint, but it is often listed as being the same as the SharePoint “Everyone”.)
  • Everyone is defined at the SharePoint level and includes all users authenticated to SharePoint.
  • Everyone except external users is found in SharePoint Online / Office 365 and is as named. External users are people not in your Active Directory, most likely not employees, who got their access from site members clicking the SHARE buttons.
  • All Users (<somename>) is SharePoint defined and represents all of the users from a selected authentication provider. (If I created a Forms Based Authentication provider named “Vendors” then I would have “Everyone (Vendors)”
  • All Users (windows) is SharePoint defined and is same as NT AUTHORITY\AUTHENTICATED USERS. After adding “All Users (windows)” to a site it is displayed as “All Users (windows)” in 2013 on prem and 2016 on prem, but is displayed as NT AUTHORITY\AUTHENTICATED USERS in Office 365.
  • Guest Contributor and Guest Reader are at this time only found in SharePoint Online / Office 365 and represent users with anonymous / link access.

 

Best Practices

I was reviewing some training materials recently and ran across a statement to the effect you should put NT AUTHORITY\AUTHENTICATED USERS in all of your site Visitors groups so everyone can find content in SharePoint. Should you do this? Should everything in your SharePoint be freely accessible to everyone who can logon to your network? Contractors, vendors, summer co-ops, part timers? If you don’t already have a policy or governance on this, then you should be working on it.

SharePoint does not give us any way to prevent the use of the “Everyone” accounts, so you will need to deal with this through education and auditing.

UPDATE! Anders Rask responded to this post with info about a SharePoint Online cmdlet that can hide these “everyone” options in the people pickers. Turns out there are three options:

Set-SPOTenant -ShowEveryoneClaim $false
Set-SPOTenant -ShowEveryoneExceptExternalUsersClaim $false
Set-SPOTenant -ShowAllUsersClaim $false

The Set-SPOTenant cmdlet: https://technet.microsoft.com/en-us/library/fp161390.aspx 
Blog:
https://blogs.office.com/2015/07/16/new-it-management-controls-added-to-onedrive-for-business/

 

Here’s a short list of best practices. The term “everyone” used here includes NT AUTHORITY\AUTHENTICATED USERS and any account that starts with “Everyone” or “All Users”.

  • Educate your users on security, including the use of the “everyone” accounts.
  • Do not use “everyone” accounts if a site contains non-public data.
  • Document who “everyone” is. There’s more than one “everyone” group in SharePoint.
  • Perform regular audits using PowerShell or 3rd party tools to track the usage of “everyone” groups.
  • Document, audit and enforce your SharePoint content policies. Document what is allowed, and what is not allowed to be stored in SharePoint.
  • If you do encourage the use of the “everyone” groups, add a banner to the top of every page that declares “Do not post confidential data in this SharePoint site! It can be seen by everyone with network access.”

 

The Built-In Accounts

While your SharePoint may vary… see the Notes column… here’s a list of the accounts that may include users other than those who you were expecting. This is not complete, so if you discover others please post a comment to this article.

DisplayName UserLogin or SystemUserKeyProperty Notes
     
All Users (membership) 
c:0!.s|forms%3amembership
Only O365
All Users (windows) 
c:0!.s|windows
Same as NT AUTHORITY\ authenticated users
All Users (yourFBAMembershipProviderName) c:0!.s|forms%3aYourFBAMembershipProviderName Form Based Authentication
Everyone c:0(.s|true   
Everyone except external users c:0-.f|rolemanager|spo-grid-all-users/17b83262-5265-… Only O365 (ID will vary)
NT AUTHORITY\ authenticated users c:0!.s|windows  
Guest Contributor SHAREPOINT\writer_9e8a77849f89425c9cff6a6af5175… ID varies with share
Guest Reader SHAREPOINT\reader_cb6f6371456b4542ba0609638a4…  
     
     
_SPOCacheFull ylo001\_spocachefull Only O365. Visible only from PowerShell
_SPOCacheRead ylo001\_spocacheread Only O365. Visible only from PowerShell
_spocrawler_17_3910 ylo001\_spocrawler_17_3910 Only O365 (ID will vary)
System Account SHAREPOINT\system Visible only from PowerShell
System Account S-1-0-0 SystemUserKeyProperty
Company Administrator s-1-5-21-1851826741-1401831065-3463747319-87287… Only O365 (ID will vary)
     
Typical user (Sam Conklin) samc@yourDomain.onmicrosoft.com As seen in O365 PowerShell
Typical user (Sam Conklin) i:0#.w|yourDomain\samc As seen in On Prem PowerShell
Typical user (Sam Conklin) i:0).w|s-1-5-21-2499188511-2905385804-3446143336-… SystemUserKeyProperty
Typical FBA user (Susan) i:0#.f|YourFBAMembershipProviderName|susan Form Based Authentication

.

3/06/2016

SharePoint: The Waffle button is the Waffle button!

 

Something for the SharePoint trivia department…

What do you call this:

image

I had always thought that calling the App Launcher button in Office 365 and SharePoint 2016 the “waffle button” was a bit of a joke. It does look kind of like a waffle, there is no mouse-over tip to give a hint, and no one would ever guess “App Launcher”. Turns out that the word “waffle” is actually in the HTML! So going forward, I will consider both to be an acceptable name for the button.

image

 

Ok, back to work… do something useful…

 

.

12/30/2015

SharePoint – Adding Dropdown Menus without the Publishing Feature

 

The following works in SharePoint 2013, 2016 (beta 2) and SharePoint Online.

 

One of the common reasons to enable the Publishing Feature was to get the Navigation page so you could have dropdowns in the Top Link bar. Turns out that in 2013 and later you can do this without the Publishing Feature.

The Trick!

The trick is drag and drop. Starting with SharePoint 2013 you have an “EDIT LINKS” button on the page. (No Top Link Bar or Navigation page needed!)

image

When you click EDIT LINKS you can add a new item to the menu by clicking the (+) button.

image

Then there’s the trick! Drag the new link just under the parent link. (I’ll drag this one under the “Subsite1” link.)

image

image

Click Save and now you have dropdowns!

image

 

What you don’t get…

The Publishing feature Navigation page lets you select options like Open in New Window and Audience selection.

But if all you need are some dropdowns…

 

.

12/22/2015

SharePoint JS Link Context Object Details

This article applies to SharePoint 2013, 2016 and SharePoint Online.

This article is a work in progress!

 

It seems I’ve been writing a lot of JS Link lately and I’m always playing a guessing game with the data available via the “context” parameter. If you know where to look, you can find this info right in the page! Just because you can find it does not mean you know what it is or how to use it. This article is my collection of notes “so far”. I will be back to update as I have time and learn more!

 

Context

Each of the functions you write for JS Link will be passed a “context” object as a parameter. From this object you can retrieve properties about the current list, current list item and other objects. In the rest of the article are examples of the data returned from the context object.

There are several child context objects that you may be working with: (documented below)

  • Context.CurrentItem for a list item
  • Context.CurrentItem.somefile (results vary based on field type)
  • Context.CurrentItem.AssignedTo
  • Context.CurrentFieldSchema
  • Context.ListData  <—This represents the rows of data in the web part.
  • Context.ListSchema
  • Context.ListSchema.PropertyBag
  • Context.Templates
  • Context.Templates.Fields
  • Context.BasePermissions

By context, I am referring to the object passed in to a JavaScript function registered by SPClientTemplates.TemplateManager.RegisterTemplateOverrides and not the object passed to RegisterTemplateOverrides. (Too many JS Link code examples on the web name the object passed to RegisterTemplateOverrides as “ctx”, “context” or other names that imply context.)

(function () { 

  // do all of the setup work...
  var overrides = {};
  overrides.Templates = {}; 

  // define the web part view
  overrides.Templates.Header = "<b>Cool Web Part</b> <ul>";
  overrides.Templates.Footer = "</ul> Check back for updates!";
  overrides.Templates.Item =
function(ctx) {return "<li>" + ctx.CurrentItem.Title + "</li>"}; // register the override SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrides); })();

 

 

List Data

JS Link passes the context data as a parameter to your functions. When working with other JavaScript code you often need to access data about the web parts on the page. In SharePoint 2013, 2016 and SharePoint Online, metadata about the content of list web parts is embedded in the page’s JavaScript as JSON data. This data is preloaded into variables with names based on the web part names. Examples: WPQ3ListData, WPQ4ListData, etc. You can access these variables directly, or use ListData property of the “context” variable passed into JS Link functions.

To discover the metadata about a list, i.e. the Title, URL, etc., search for “new ContextInfo”. 

Ways of finding the list items data:

  • In your browser visit the list or library page and use the browser’s View Source feature to see the JSON formatted data that describes the list and list data. Search for “ListData =”.
  • Use the F12 Tools to access the global ListData variables:  WPQ3ListData, WPQ4ListData, etc.
  • Run some custom JavaScript to dump the context objects as nice HTML tables.

 

Using View Source

An example of the View Source where I searched for “ListData” and found the fields in the ListData section for one of the web parts in the page:

image

 

The View Source approach is a quick way to discover:

  • The internal names of fields. For example, you can’t find “% complete” here but you can find “PercentComplete”.
  • That some items are simple data types and some are collections or objects that require extra work to access.
    clip_image002
    To access the Priority property all you need to use is ctx.CurrentItem.Priority. To access AssignedTo you won’t be able to just use ctx.CurrentItem.AssignedTo. Note the square bracket (“[“) in the data. This indicates that this is a collection of objects, so at a minimum you will need to use ctx.CurrentItem.AssignedTo[0] to retrieve the first object. Also note the curly brackets (“{“) that indicate an object. To use this data you will need to specify the object’s property like this: ctx.CurrentItem.AssignedTo[0].title.

 

 

The Context Object

This list has the sample results from a context object for a task list. (Comments in blue.) Note that many of the properties are themselves objects or collections objects.

Property

Value

library only

listBaseType

0

 

listTemplate

171

This is the template ID or the Registration ID for the template used to create the list. 171 is for “Tasks (2013 version)”. For a list of IDs see: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

 

listName

{E7ADB1A8-5C1C-437F-B946-369431601856}

GUID. Unique ID for the list.

 

view

{437CC0EA-EC27-4AE9-AD44-70762F4DF28E}

GUID. Unique ID for the list.

 

listUrlDir

/sites/yourSite/Lists/Tasks

URL to the list.

 

HttpPath

https://yourDomain.com/sites/yourSite/_vti_bin/owssvr.dll?CS=65001

URL to the OWSSVR.dll remote procedure call. Returns XML. Example: https://yourDomain.com/sites/yourSite/_vti_bin/owssvr.dll?CS=65001&Cmd=Display&List={BD415E20-AC5F-41DA-BAC9-F054C4764A2}

 

HttpRoot

https://yourDomain.com/sites/yourSite

URL to the site (SPWeb) that contains the list.

 

serverUrl

null

 

imagesPath

/_layouts/15/images/

Server folder for icons and images.

 

PortalUrl

null

 

RecycleBinEnabled

1

 

enteringGridMode

false

 

inGridMode

false

 

isWebEditorPreview

0

 

rootFolderForDisplay

null

 

isPortalTemplate

null

 

isModerated

false

 

recursiveView

false

 

displayFormUrl

https://yourDomain.com/sites/yourSite/_layouts/15/listform.aspx?PageType=4&ListId=%7BE7ADB1A8%2D5C1C%2D437F%2DB946%2D369431601856%7D

Link to the View Item form. (.ASPX or InfoPath form)

 

editFormUrl

https://yourDomain.com/sites/yourSite/_layouts/15/listform.aspx?PageType=6&ListId=%7BE7ADB1A8%2D5C1C%2D437F%2DB946%2D369431601856%7D

Link to the Edit Item form. (.ASPX or InfoPath form)

 

newFormUrl

https://yourDomain.com/sites/yourSite/_layouts/15/listform.aspx?PageType=8&ListId=%7BE7ADB1A8%2D5C1C%2D437F%2DB946%2D369431601856%7D&RootFolder=

Link to the New Item form. (.ASPX or InfoPath form)

 

ctxId

27

 

CurrentUserId

9

This is the Site Collection ID of the user and will be different in each Site Collection.

 

isForceCheckout

false

 

EnableMinorVersions

false

 

ModerationStatus

0

 

verEnabled

0

 

isVersions

0

 

WorkflowsAssociated

false

 

ExternalDataList

false

 

HasRelatedCascadeLists

1

 

CascadeDeleteWarningMessage

null

 

ContentTypesEnabled

true

 

SendToLocationName

 

 

SendToLocationUrl

 

 

StateInitDone

false

 

TotalListItems

null

 

CurrentSelectedItems

null

 

LastSelectableRowIdx

null

 

SelectAllCbx

null

 

TableCbxFocusHandler

null

 

TableMouseoverHandler

null

 

onItemSelectionChangedHandlers

 

 

wpq

WPQ2

This is part of the web part’s name (“WebPartWPQ2”) and prefix for other related variables such as WPQ2ListData and WPQ2SchemaData.

 

Templates

[object Object]

See “Context.Templates” below.

 

ListData

[object Object]

See “Context.ListData” below.

ctx.ListData[idOfCurrentItem] is the same as ctx.CurrentItem.

 

ListSchema

[object Object]

See “Context.ListSchema” below.

 

BaseViewID

1

 

ListTemplateType

171

This is the template ID or the Registration ID for the template used to create the list. 171 is for “Tasks (2013 version)”. For a list of IDs see: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

 

existingServerFilterHash

undefined

 

noGroupCollapse

true

Only present if view Grouping is enabled and “By default, show groupings” is set to “Collapsed”.

 

NavigateForFormsPages

true

 

BasePermissions

[object Object]     

See Context.BasePermissions below.

 

CurrentUserIsSiteAdmin

true

 

IsAppWeb

false

 

AllowGridMode

true

 

rootFolder

 

 

viewTitle

All Tasks

Title of the current view.

 

NoScriptEnabled

false

 

OfficialFileName

 

 

OfficialFileNames

 

 

WriteSecurity

1

 

SiteTitle

JS Link Demo 1

 

ListTitle

Tasks

 

isXslView

true

 

IsClientRendering

true

 

RegionalSettingsTimeZoneBias

300

Contains the bias, in minutes, that a time zone differs from Coordinated Universal Time (UTC), or the bias, in minutes, that standard time or daylight saving time for a time zone differs from UTC. 

 

NewWOPIDocumentEnabled

True

Lib

NewWOPIDocumentUrl

/sites/yourSite/_layouts/15/CreateNewDocument.aspx?SaveLocation=%2Fsites%2FyourSite%2FShared%20Documents&DefaultItemOpen=1

Lib

AllowCreateFolder

true

Lib

SiteTemplateId

1

 

bInitialRender

true

 

ListDataJSONItemsKey

Row

 

ControlMode

4

 

SiteClientTag

0$$16.0.4622.1221

 

CurrentLanguage

1033

Locale IDs Assigned by Microsoft. 1033 = US English. See: https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

 

CurrentCultureName

en-US

 

CurrentUICultureName

en-US

 

OnPreRender


JS Link function defined for current web part.

 

OnPostRender

function(){var a=document.getElementById("cbxSelectAllItems"+b.ctxId),c="ontouchstart"in document.documentElement&&!IsSupportedChromeOnWin()?"touchstart":"click";$addHandler(a,c,function(){a.checked=!a.checked;if(ListModule.Settings.SupportsItemSelection){WriteDocEngagementLog("Documents_SelectAllClick","OneDrive_SelectAllClick");ToggleAllItems(c,a,b.ctxId)}})},function(){setTimeout(j,0)}

JS Link function defined for current web part. The above example is a “default” function.

 

canDragUpload

true

 

RenderView

function g(a){return b(a,"View")}

 

RenderHeader

function l(a){return b(a,"Header")}

 

RenderBody

function n(a){return b(a,"Body")}

 

RenderFooter

function j(a){return b(a,"Footer")}

 

RenderGroups

function k(a){if(a==null||a.ListData==null)return"";var b=null;if(a.Templates!=null)b=a.Templates.Group;var k=a.ListData,j=k[f(a)],h="";if(j==null){if(typeof b=="string"||typeof b=="function"){a.CurrentGroupIdx=0;a.CurrentGroup=k;a.CurrentItems=k[c(a)];h+=CoreRender(b,a);a.CurrentItems=null;a.CurrentGroup=null}return h}for(var i=0;i<j.length;i++){var g=j[i],e=d(a,g,"Group");if(e==null||e==""){if(b==null||b=={})return"";if(typeof b=="string"||typeof b=="function")e=b;if(e==null||e==""){var l=g.GroupType;e=b[l]}}if(e==null||e=="")continue;a.CurrentGroupIdx=i;a.CurrentGroup=g;a.CurrentItems=g[c(a)];h+=CoreRender(e,a);a.CurrentGroup=null;a.CurrentItems=null}return h}

 

RenderItems

function m(a){if(a==null||a.ListData==null)return"";var g=null;if(a.Templates!=null)g=a.Templates.Item;var p=a.ListData,e=a.CurrentItems;if(e==null)e=typeof a.CurrentGroup!="undefined"?a.CurrentGroup[c(a)]:null;if(e==null){var l=p[f(a)];e=typeof l!="undefined"?l[c(a)]:null}if(e==null)return"";for(var j="",h=0;h<e.length;h++){var i=e[h],b=d(a,i,"Item");if(b==null||b==""){if(g==null||g=={})return"";if(typeof g=="string"||typeof g=="function")b=g;if(b==null||b==""){var o=i.ContentType;b=g[o]}}if(b==null||b=="")continue;a.CurrentItemIdx=h;a.CurrentItem=i;if(typeof a.ItemRenderWrapper=="string")a.ItemRenderWrapper==SPClientRenderer.ParseTemplateString(a.ItemRenderWrapper,a);if(typeof a.ItemRenderWrapper=="function"){var k=a.ItemRenderWrapper,m={TemplateFunction:k,Operation:"ItemRenderWrapper"},n=function(){return k(CoreRender(b,a),a,b)};j+=CallFunctionWithErrorHandling(n,a,"",m)}else j+=CoreRender(b,a);a.CurrentItem=null}return j}

 

RenderFields

function i(a){if(a==null||a.Templates==null||a.ListSchema==null||a.ListData==null)return"";var f=a.CurrentItem,b=a.ListSchema.Field,d=a.Templates.Fields;if(f==null||b==null||d==null)return"";var c="";for(var g in b)c+=e(a,b[g]);return c}

 

RenderFieldByName

function h(a,c){if(a==null||a.Templates==null||a.ListSchema==null||a.ListData==null||c==null||c=="")return"";var d=a.CurrentItem,b=a.ListSchema.Field,g=a.Templates.Fields;if(d==null||b==null||g==null)return"";if(typeof SPClientTemplates!="undefined"&&spMgr!=null&&a.ControlMode==SPClientTemplates.ClientControlMode.View)return spMgr.RenderFieldByName(a,c,d,a.ListSchema);for(var f in b)if(b[f].Name==c)return e(a,b[f]);return""}

 

heroId

idHomePageNewItem

 

CurrentItem

[object Object]

See “Context.CurrentItem” below.

 

CurrentItemIdx

0

 

CurrentFieldSchema

[object Object]

See “Context.FieldSchema” below.

 

allowedSuiteExtensionFileTypes

bmp,chm,gif,htm,html,jpeg,jpg,pdf,png,psd,tif,txt,wma,wmv,xml,zip

Lib

 

 

Context.CurrentItem

These properties are retrieved from the CurrentItem property of the Context. This example is for a Task list. Properties unique to a task list are marked “(Task list field.)”.

 

Property

Value

outlineLevel

1

For task lists. Top level task = 1. First child = 2, etc.

ID

5

Internal generated list item ID. Starts at 1. This is the ID column in a view.

PermMask

0x7fffffffffffffff

Permissions Mask. See https://msdn.microsoft.com/en-us/library/cc704409.aspx and http://sympmarc.com/2009/02/03/permmask-in-sharepoint-dvwps/

FSObjType

0

ContentType

Task

Also see ContentTypeId below.

Checkmark

No

PercentComplete

45.5 %  

(Task list field.)

Returns a string with a percent sign.

PercentComplete.

0.455000000000000 

(Task list field.)

Returns a number between 0 and 1.

Due the the “.” in the property name you will need to use the index notation to retrieve this: ctx.CurrentItem['PercentComplete.'].

Title

Task99

List/library item title.

FileLeafRef

5_.000                  Mydocument.docx

Name in path for item. (File name for library documents.)

Created_x0020_Date.ifnew

Returns “1” if the “New” icon should be displayed.

FileRef

/sites/demosite/Lists/Tasks/5_.000
/sites/demosite/Documents/Mydocument.docx

Relative path to item.

File_x0020_Type

docx

File extension for library item.

File_x0020_Type.mapapp

undefined

HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon

 

HTML_x0020_File_x0020_Type.File_x0020_Type.mapico

 

ContentTypeId

0x0108001C2144D361847C438854B157E203AB3E

DueDate


(Task list field.)

DueDate.FriendlyDisplay

undefined

(Task list field.)

See “Modified.FriendlyDisplay”.)

AssignedTo

[object Object]

Returns a collection of users, even if only one. You will need to index the collection. “ctx.CurrentItem.AssignedTo[0]” See Context.CurrentItem.AssignedTo below.

Priority

(2) Normal

(Task list field.)

Status

Not Started

(Task list field.)

Modified

11/18/2015 6:47 PM

Modified.FriendlyDisplay

undefined

Due the the “.” in the property name you will need to use the index notation to retrieve this: ctx.CurrentItem['Modified.FriendlyDisplay']. This property only returns “codes” that represent friendly dates. Display the date using GetRelativeDateTimeString(ctx.CurrentItem["Modified.FriendlyDisplay"]) to display “4 minutes ago” (instead of “1|0|3|5”) or “October 26” (instead of “0|October 26”).

_ModerationStatus

Pending

Content Approval text value of status. Property is only available if Content Approval is enabled. 

_ModerationStatus.

2

Content Approval numeric value of status. Property is only available if Content Approval is enabled. Approved=0, Rejected=1, Pending=2. Due to the “.” in the name you will need to use indexer access:  ctx.CurrentItem[“_ModerationStatus.”]

firstRow

true

Returns “true” for the first row, otherwise returns “undefined”. 

 

Context.CurrentItem.field for a Most Columns

For most columns the data is just returned as a string. Example: ctx.CurrentItem.Modified.

 

Context.CurrentItem.field for a Hyperlink Columns

Hyperlink columns are represented by two fields: fieldname and fieldname.desc Example: ctx.CurrentItem.ProductPicture and ctx.CurrentItem["ProductPicture.desc"] (Note that fields with dots must be accessed with using index notation.)

 

Context.CurrentItem.field for a Lookup Column

Lookup columns are returned as a collection of objects. (It may be a multiple choice column.) It must be accessed using an indexer: ctx.CurrentItem.TestLookup[0].

Property

Value

lookupId

2

lookupValue

Sales Department

isSecretFieldValue

false

 

Context.CurrentItem.field for a Managed Metadata Column

Managed Metadata columns are returned as objects. Example: ctx.CurrentItem.ToyCategory.Label

Property

Value

__type

TaxonomyFieldValue:#Microsoft.SharePoint.Taxonomy

Label

Boats

TermID

6eb29e02-8be0-4544-b2a7-d5d9fb2ea4f2

 

 

Context.CurrentItem (for the document library item)

 

Property

Value

ID

1

PermMask

0x7fffffffffffffff

Permissions Mask. See https://msdn.microsoft.com/en-us/library/cc704409.aspx and http://sympmarc.com/2009/02/03/permmask-in-sharepoint-dvwps/

FSObjType

0

HTML_x0020_File_x0020_Type

 

UniqueId

{AE945D21-B2CD-4C32-A7E4-B45D51C45F0D}

ProgId

 

File_x0020_Type

xlsx

File_x0020_Type.mapapp

undefined

HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon

(Returns the object used to open a document in Office. “SharePoint.OpenDocuments”)

HTML_x0020_File_x0020_Type.File_x0020_Type.mapico

(Returns the icon for the file type. Example: icdocx.png)

serverurl.progid

(Example: 1https://yourDomain.com/sites/yourSite/Shared Documents/Event budget.xlsx?d=wae945d21b2cd4c32a7e4b45d51c45f0d )

ServerRedirectedEmbedUrl

https://yourDomain.com/sites/yourSite/_layouts/15/WopiFrame.aspx?sourcedoc={ae945d21-b2cd-4c32-a7e4-b45d51c45f0d}&action=interactivepreview

File_x0020_Type.progid

undefined

File_x0020_Type.url

undefined

FileRef

/sites/yourSite/Shared Documents/Event budget.xlsx

Relative path to the file.

FileLeafRef

Event budget.xlsx

Name in path for item. (File name for library documents.)

CheckoutUser

 

CheckedOutUserId

 

IsCheckedoutToLocal

0

Created_x0020_Date.ifnew

(Returns “1” if the “New” icon should be displayed)

ContentTypeId

0x010100DE3AED5D38F22748B9EA70FF971BAAB7

Modified

11/16/2015 7:56 PM

Modified.FriendlyDisplay

undefined

Editor

[object Object]

Title

This is the title for the budget file

Title property

firstRow

true

Returns “true” for the first row, otherwise returns “undefined”. 

 

Context.CurrentItem.AssignedTo

This is a collection. You will need to access using an indexer. Example ctx.CurrentItem.AssignedTo[0]. To retrieve a user property: ctx.CurrentItem.AssignedTo[0].title

Property

Value

 

id

12

This is the Site Collection ID of the user and will be different in each Site Collection.

value

Sam Conklin

title

Sam Conklin

email

samc@microsmith.onmicrosoft.com

sip

samc@microsmith.onmicrosoft.com

picture

https://microsmith-my.sharepoint.com:443/User%20Photos/Profile%20Pictures/samc_microsmith_onmicrosoft_com_MThumb.jpg

jobTitle

IT Manager

department

IT

 

 

 

Context.CurrentFieldSchema

This example is for the Modified date column and is not currently a complete list.

Property

Value

Name

Modified

FieldType

DateTime

RealFieldName

Modified

DisplayName

Modified

ID

28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f

ReadOnly

TRUE

“ReadOnly” is only in the property list when the field is read only. I.e., you will not see “ReadOnly=FALSE”.

role

DateTime

ariaLabel

Modified

Type

DateTime

AllowGridEditing

FALSE

“AllowGridEditing” is only in the property list when the value is FALSE.

counter

3

FieldTitle

Modified

css

ms-cellstyle ms-vb2

fieldRenderer

your custom JS Link code is here

 

 

Context.ListData

Property

Value

Row

[object Object]

FirstRow

1

FolderPermissions

0x7fffffffffffffff

LastRow

1

FilterLink

?

ForceNoHierarchy

 

HierarchyHasIndention

 

 

Context.ListSchema

Property

Value

 

Field

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]  (one object per field.)

 

LCID

1033

Locale IDs Assigned by Microsoft. 1033 = US English. See: https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

 

Userid

9

 

PagePath

/sites/yourSite/Lists/Tasks/AllItems.aspx

 

ShowWebPart

 

 

View

{437CC0EA-EC27-4AE9-AD44-70762F4DF28E}

 

RootFolderParam

View={437cc0ea-ec27-4ae9-ad44-70762f4df28e}&

 

FieldSortParam

 

 

HttpVDir

https://yourDomain.com/sites/yourSite

 

IsDocLib

 

 

UIVersion

15

 

NoListItem

There are no items to show in this view of the "Tasks" list.

 

NoListItemHowTo

To add a new item, click "New".

 

DefaultItemOpen

1

 

ForceCheckout

0

 

Direction

none

 

UseParentHierarchy

1

List

ParentHierarchyDisplayField

LinkTitle

List

TabularView

1

 

EffectivePresenceEnabled

1

 

PresenceAlt

No presence information

 

UserDispUrl

/sites/yourSite/_layouts/15/userdisp.aspx

 

SelectedID

-1

 

ListRight_AddListItems

1

 

FolderRight_AddListItems

1

 

InplaceSearchEnabled

1

 

HasTitle

1

Lib

StrikeThroughOnCompletedEnabled

1

List

RenderViewSelectorPivotMenu

True

 

ViewSelectorPivotMenuOptions

JSON representing the view selector menu

 

RenderSaveAsNewViewButton

True

 

Toolbar

Standard

 

PropertyBag

[object Object]

List

 

Context.ListSchema.PropertyBag 

(This is empty in a document library and is likely to be different for each list/library type.)

Property

Value

vti_hassubdirs

true

vti_listbasetype

0

vti_listrequirecheckout

false

vti_dirlateststamp

11/18/2015 11:59:25 PM

vti_replid

rid:{313BBBC4-BF57-4406-B24B-23B089C0217A}

vti_rtag

rt:313BBBC4-BF57-4406-B24B-23B089C0217A@00000000256

vti_isbrowsable

true

vti_listservertemplate

171

This is the template ID or the Registration ID for the template used to create the list. 171 is for “Tasks (2013 version)”. For a list of IDs see: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

vti_docstoretype

1

vti_listenableminorversions

false

vti_level

1

vti_isscriptable

false

vti_isexecutable

false

vti_docstoreversion

256

vti_listenablemoderation

false

vti_foldersubfolderitemcount

0

vti_listtitle

Tasks

vti_metainfoversion

1

vti_folderitemcount

1

vti_timelastmodified

11/18/2015 11:47:55 PM

vti_nexttolasttimemodified

11/18/2015 11:47:38 PM

vti_parentid

{415EA0AD-179C-4267-A90D-1BC43E9EB261}

vti_candeleteversion

true

vti_listenableversioning

false

vti_listname

{E7ADB1A8-5C1C-437F-B946-369431601856}

vti_etag

"{313BBBC4-BF57-4406-B24B-23B089C0217A},256"

vti_timecreated

11/17/2015 12:37:02 AM

 

 

Context.Templates

Property

Value

 

View

function RenderViewTemplate(a){var b=a.RenderHeader(a);b+=a.RenderBody(a);b+=a.RenderFooter(a);return b}

Header

function(b,e){  … lots of code here … }

Body

function(a){  … lots of code here … }

Footer

 

Group

function RenderItemTemplateDefault(a){return a!=null&&typeof a.RenderItems=="function"?a.RenderItems(a):""}

Item

function RenderFieldTemplateDefault(a){return a!=null&&typeof a.RenderFields=="function"?a.RenderFields(a):""}

Fields

[object Object]   (See Context.Templates.Fields below.) 

 

Context.Templates.Fields

This is a property of Context.Templates. The actual properties return depend on your list. The following is for a task list.

Property

Value

Checkmark

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

LinkTitle

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

DueDate

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

AssignedTo

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

PercentComplete

function percentComplete(ctx) { var x = ctx.CurrentItem[ctx.CurrentFieldSchema.Name].replace(" ",""); return '<div class="ms-progress-meter"><div class="ms-progress-meter-inner" style="width: ' + x +';"></div></div>' }    ß This is an example of a custom JS Link template in use.

Priority

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

Status

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

Modified

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

 

Context.BasePermissions

This is a property of the Context object.

Property

Value

ManageLists

true

ManagePersonalViews

true

OpenItems

true

 

 

.

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.