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 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 c:0!.s|forms%3amembership Only O365 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/10/2016
SharePoint: I Just Love Consistency! SharePoint, Not So Much
SharePoint 2016 is so similar to SharePoint Online / Office 365 that it’s sometimes hard to tell which version you are in. I just ran across an odd change from the past versions. How do you share or break inheritance on a list item?
The steps are different and the end results are different. And I thought 2016 was supposed to be SharePoint Online brought onsite.
SharePoint 2013
- Shared With is available in the ITEMS ribbon and the ribbon of the View Properties page.
- The “…” menu has a Shared With option:
- The above link takes you to the Shared With popup.
SharePoint Online / Office 365
- Shared With is available in the ITEMS ribbon and the ribbon of the View Properties page.
- The “…” menu has a Share option:
- The above link takes you to the Shared With popup.
SharePoint 2016
- Shared With is grayed out in the ITEMS ribbon, but is available in the ribbon of the View Properties page.
- The “…” menu has an Advanced popout that has a Manage Permissions option:
- The above link takes you to the user.aspx Permissions page.
I write training materials and really wish I was paid by the word or page! These detail differences waste hours and complicate training!
.
SharePoint: Undocumented Pending Shares Page
Article applies to SharePoint 2013, SharePoint Online and SharePoint 2016.
Did you ever wonder after using the Share buttons in SharePoint if the Site Owner ever responded to your request, responded with a question, or approved the request?
The My Permissions page
As I can’t find any documentation, I’ll call this undocumented for now… After a bit of web searching I did find a mention of the page in an Ignite presentation. In any case, this page lists the status of pending requests and lets the user who made the request check and send messages to the site owners. Requests that have been approved or declined will not be listed here.
The site owner can see your requests by going to Settings (gear), Site Settings, Site Permissions and clicking “Show access requests and invitations”. This will take them to the Access Requests page at _layouts/Access%20Requests/pendingreq.aspx.
You can check your pending requests by going to:
http://yourDomain/sites/yourSite/_layouts/mypermissions.aspx
This link will redirect to /_layouts/15 for now and may change in future versions.
Of course, no one knows about this page. There are no out of the box links to it. And… the site owner will probably not know to click the “SEND” button to start a conversation with the person who made the request.
If “Sharing” is important in your organization, you will need to provide some training, easy access to a link to the MyPermissions page, and do some work to “drive adoption”.
Details:
- Only “Pending” requests are displayed. Approved requests are not.
- You can click the “…” to see messages from the site owner, or to send a message to the site owner.
- This pending invites listed are unique to the current site. I.e. each site has its on MyPermissions page.
.
3/08/2016
SharePoint PowerShell Training for Auditing and Site Content Administration
If you have followed this blog, you know that I’m kind of a SharePoint nut who’s also a PowerShell nut. Over the years I have created a lot of PowerShell scripts while working with SharePoint and answering questions in my classes and in the TechNet forums. There’s plenty of resources for installing and configuring SharePoint using PowerShell, but there’s little on dealing with all of the daily questions on premise admins get that can be quickly answered using PowerShell. I was just going to take my 100+ scripts and create something like a “cookbook”, but instead created a class. The class handout kind of ended up as the cookbook… 85 pages and 175 sample scripts, or maybe more like a giant PowerShell cheatsheet for SharePoint.
This class is for on-premise SharePoint 2010, 2013 and 2016 administrators. A SharePoint Online version is in the works, but not available yet.
If you would like to attend this class, delivered by the author (your’s turely!), we are offering it next Monday, March 14th, at MAX Technical Training in Cincinnati, Ohio. You can attend this class at MAX or remotely from anywhere. If you can’t attend this class, it is available from trainging centers all over the world.
March 14th class at MAX: SharePoint 2010 and 2013 Auditing and Site Content Administration using PowerShell
Search for this class at other training centers: https://www.bing.com/search?q=55095%20powershell
If you would like to see some of the other courses and books I’ve written, then click here.
55095 SharePoint 2010 and 2013 Auditing and Site Content Administration using PowerShell
This one day instructor-led class is designed for SharePoint 2010 and 2013 server administrators and auditors who need to query just about anything in SharePoint. The class handout is effectively a cheat sheet with over 175 PowerShell scripts plus the general patterns to create your own scripts. These scripts cover:
- using the SharePoint Management Shell and the ISE
- general tips for counting, reformatting and exporting results;
- drilling up and down the SharePoint object model
- getting lists / inventories of servers, services web applications, sites, webs, lists, libraries, items, fields, content types, users and much more
- finding lists by template type, content type and types of content
- finding files by user, content type, file extension, checked out status, size and age
- finding inactive sites
- finding and changing SharePoint Designer settings and finding and resetting customized pages
- inventorying and managing features
- deleting and recycling files and list items
- inventorying users and user permissions and finding out “who can access what”
- creating sites, lists and libraries
- uploading and downloading files
- and much more…
At Course Completion
After completing this course, students will be able to:
- Use PowerShell to query just about anything inside of SharePoint.
- Understand the core SharePoint object model and object hierarchy as seen from PowerShell.
- Format PowerShell output in to reports.
- Manage resources to limit the impact on production servers.
- Create and delete Site Collections, subsites, lists, libraries and content.
Prerequisites
Before attending this course, students must:
- Very good knowledge of SharePoint and its features.
- Good experience using PowerShell 2 or later or recent completion of a PowerShell class such as 10961 or 50414.
Course Outline
Module 1: SharePoint and PowerShell
This module provides an introduction to the topics covered in the class, introduces SharePoint PowerShell terminology and provides a review of important PowerShell features.
Lessons:
- History of PowerShell in SharePoint
- PowerShell vs. Search
- PowerShell, SharePoint Management Shell and cmdlets
- Security and Permissions Needed
- Getting Started with PowerShell: Counting Items, Custom Columns, Reformatting Numbers, Saving Results to a File
- Changing and Updating Content: Creating SharePoint Objects, Changing Objects
Lab:
- Using PowerShell with SharePoint
After completing this module, students will be able to:
- Get started using PowerShell to inventory and update SharePoint.
Module 2: Working with SharePoint CMDLETs and Objects
This module introduces the SharePoint object model and some important terminology.
Lessons:
- GUIDs
- Sites vs. Webs
- The SharePoint Object Hierarchy
Lab:
- Get a list of all Site Collections and their GUIDs
- Get a list of all Webs in all Site Collections
- Given a web’s URL get its parent web and web application
After completing this module, students will be able to:
- Explore sites and webs using PowerShell.
- Retrieve important properties of common SharePoint objects
Module 3: Managing Memory and Limiting Performance Impact
This explores limiting impact on server memory usage and performance.
Lessons:
- Memory Management and Disposing Objects
- Limiting Impact on Production Servers
Lab:
- Exploring PowerShell’s use of system memory.
- Testing the impact of scripts on server performance
After completing this module, students will be able to:
- Recognize and manage the impact of PowerShell on a SharePoint server.
Module 4: Working with Content
This module explores SharePoint using PowerShell from the Farm down to individual list items.
Lessons:
- Getting Farm Information: version, services, services, features
- Getting Web Application information
- Exploring Site Collections: retrieve Site Collections, Site Collection Administrators, quotas
- Working with the Recycle Bins: finding items, getting file counts and bytes, deleted sites
- Exploring Webs: web templates, finding webs, finding webs based on template, Quick Launch and Top Link Bar navigation
- Exploring Lists and Libraries: finding all lists, lists by type, lists by Content Type, columns/fields, document count by web or library
- Exploring Content Types
- Finding documents: by a word in the title, file type, content type, size, date age, checked out status, approval status and many more…
- Deleting content
- Downloading and uploading files
Lab:
- Explore the farm.
- Inventory site collections.
- Create a recycle bin report.
- Finding all blog sites.
- Find all picture libraries.
- Find all PDF files over 5 MB.
- Delete all videos in a site collection.
After completing this module, students will be able to:
- Explorer, inventory and maintain SharePoint content using PowerShell.
Module 5: Users and Security
This module covers the use of PowerShell to explore and document SharePoint permissions.
Lessons:
- Users: find a user, get a list of all users, working with Active Directory groups
- SharePoint groups: Get lists of groups, get the members of a group, find all groups a user belongs to, find the groups associated with a web
- Expanding users lists that include Active Directory groups
- Documenting Broken Inheritance / Unique Permissions: webs, lists, libraries, folders, items
- Working with Role Assignments
Lab:
- Get a list of all users who have access to a Site Collection.
- Get a list of all groups in a Site Collection.
- Get a list of all groups a user belongs to.
- List all users who may have access to a SharePoint securable.
- Get a list of all securables with broken inheritance.
After completing this module, students will be able to:
- Explore and document users and user permissions.
- Explore and document SharePoint groups.
- Explore and document broken inheritance.
Module 6: Managing Sites
This module explorers Site Collection and Web management from PowerShell.
Lessons:
- Finding Inactive Webs
- Creating and Deleting Site Collections
- Getting Site Collection Data
- Creating and Deleting Subsites
- Working With SharePoint Designer Settings
Lab:
- Create a report for inactive sites.
- Create a site collection and subsites.
- Delete a site.
- Delete a site collection.
- Disable SharePoint Designer in all site collections.
After completing this module, students will be able to:
- Manage SharePoint Site Collections and webs from PowerShell.
Audience
- SharePoint server administrators.
- SharePoint auditors.
- Also valuable for SharePoint developers.
2/21/2016
Hide the Attachments Link in a SharePoint Form
The problem… While we do want site visitors to see the list items, we don’t want them to see or click the list’s attachments.
More SharePoint Customization tricks!
More Site Owner articles.
More articles about the SPSecurityTrimmedControl One approach is to use CSS and a handy SharePoint control. You could also write a JavaScript solution. Here we will look at the CSS option.
Note: This is not security! This is hiding some HTML using CSS. Users can right-click and select View Source to discover the text hidden by the CSS.
General pattern:
- View the DispForm.aspx page (the view properties popup in SP 2010) for an item in the list.
- Press F12 to open the IE Developer Tools.
- Use the Internet Explorer F12 panel’s Select Element button to discover an appropriate tag and ID that could changed by CSS to show/hide the content. (For this example it happens to be “idAttachmentsRow”.)
- Edit the DispForm.aspx page using SharePoint Designer.
- Add CSS to hide the tag from everyone.
- Add a SharePoint control with additional CSS to unhide the content for users with at least the Edit permission. Set the SharePoint control to only display its content for people who can edit list items.
The SPSecurityTrimmedControl
The magic here is that the SPSecurityTrimmedControl can selectively display content based on a user’s assigned permission. As an example, users with the Read permission level do not have the EditListItems permission while members and owners do. Note that the control can only be set to a single permission, not a Permission Level or group.
More detailed steps:
- Open SharePoint Designer and your site.
- Click Lists and Libraries and your list.
- Click the DispForm.aspx file.
- In the ribbon click Advanced Mode.
- Find the PlaceholderMain Content tag (<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">)
- Add the following block of HTML just after that tag.
- Save your changes and test.
SharePoint 2010 (and probably 2007) version:
<style type="text/css">
#idAttachmentsRow { display:none }
</style>
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="EditListItems">
<style type="text/css">
#idAttachmentsRow { display:inline }
</style>
</Sharepoint:SPSecurityTrimmedControl>
SharePoint 2013 and SharePoint Online / O365 (and probably 2016) version:
<style type="text/css">
#idAttachmentsRow { display:none !important }
</style>
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="EditListItems">
<style type="text/css">
#idAttachmentsRow { display:table-row !important}
</style>
</Sharepoint:SPSecurityTrimmedControl>
A list of the PermissionsStrings can be found here: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx
More about using SPSecurityTrimmedControl can be found here: http://techtrainingnotes.blogspot.com/2009/07/sharepoint-run-javascript-based-on-user.html
.
2/20/2016
If you have not finished your SharePoint 2013 Dev Certs… better get to work!
Microsoft is “expiring” a long list of exams in September.
You may also want to see:
Azure Exams 70-532, 70-533
and 70-534 Getting an Update!
More certification articles.
This means that: - Anyone working on the related certifications has six months to complete these exams, or never be able to finish certifications they have been working on.
- Anyone wanting these certifications better get started ASAP.
- Time to review your study and training plans and budgets!
- You should review the rest of the “Expiring exams list” to see what else is going away, and check this list periodically . (dates currently range from March to Sept 2016.)
- New certifications, exams and classes are going to be announced soon.
These certifications are Impacted. (The tests for them expire 9/16.)
- MCSD: Windows Store Apps Using HTML5 (481, 482, 490)
- MCSD: Windows Store Apps Using C# (484, 485, 491)
- MCSD: SharePoint Applications 2013 (488, 489, 517)
These exams are going away in September:
- 481: Essentials of Developing Windows Store Apps Using HTML5 and JavaScript
- 482: Advanced Windows Store App Development Using HTML5 and JavaScript
- 484: Essentials of Developing Windows Store Apps Using C#
- 485: Advanced Windows Store App Development Using C#
- 488: Developing SharePoint Server 2013 Core Solutions
- 489: Developing SharePoint Server 2013 Advanced Solutions
- 490: Recertification for MCSD: Windows® Store Apps using HTML5
- 491: Recertification for MCSD: Windows Store Apps using C#
- 492: Upgrade Your MCPD: Web Developer 4 to MCSD: Web Applications Examination
- 499: Recertification for MCSD: Application Lifecycle Management
- 517: Recertification for MCSD: SharePoint Applications
Links:
- https://www.microsoft.com/en-us/learning/retired-certification-exams.aspx
- https://borntolearn.mslearn.net/b/weblog/archive/2016/02/16/exam-retirement-update-what-39-s-retiring-in-september-2016
- https://borntolearn.mslearn.net/b/weblog/archive/2016/02/18/additional-details-on-upcoming-exam-retirements
- https://absolute-sharepoint.com/2016/02/microsoft-retiring-sharepoint-mcsd-developer-exams.html
- https://absolute-sharepoint.com/2016/02/microsoft-replacing-sharepoint-dev-certifications-office-365.html
.
1/03/2016
“Unable to display this Web Part” after XSLT Customization
The following applies to SharePoint 2013, 2016 and SharePoint Online.
The Error
“Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.”
The above error shows up in SharePoint 2013 and later when doing multi-level grouping with Data Form Web Parts. With the removal of many of the design features from SharePoint Designer 2013, I doubt there are too many people creating new XSLT customization. But if you are upgrading from 2010 or trying to implement a 2010 style customization then you many run into this error.
The Cause and the Fix
If you dig into the error logs you will find that this is reported as “Error while executing web part: System.StackOverflowException”. Turns out though that it is a timeout of the XSLT parser and has been around for quite a while. The fix is pretty easy, if you are on premises, just run a tiny PowerShell script from the SharePoint Management Shell.
$farm = Get-SPFarm
$farm.XsltTransformTimeOut = 10
$farm.Update() Some of the articles say to increase it from the default of 1 second to 5 seconds. In my test environment I typically needed to increase it to 10 seconds. If you monitor the CPU on the server you will see that at least on lab-type virtual machines that a page load where you have this issue does put quite a load on the CPU.
SharePoint Online? No joy for you! It appears that the default is 1 second, and you can’t change it.
There’s been a number of articles on the topic, mostly in the SP 2010 world:
http://thechriskent.com/tag/xslttransformtimeout/
and many more: http://www.bing.com/search?q=xslttransformtimeout+sharepoint
.
1/01/2016
Views.Add() Cannot find an overload for "Add" and the argument count: "8".
I wrote a PowerShell script to create views. It worked in PowerShell 3 on SharePoint 2013. It failed in PowerShell 2 on SharePoint 2010.
To play it safe, I copied values from an existing view to insure the correct data types…
$web = Get-SPWeb http://sharepoint/sites/training
$list = $web.lists["Announcements22"]
$v = $list.views[0]
$list.Views.add("TestView",$v.ViewFields,$v.query,30,$true,$false,$v.Type,$false)
As I can count to 8 (usually) and I made sure the data types were correct, I then wasted a lot of time google/binging the error message.
So I then did the obvious thing for a developer, I fired up Visual Studio. And… found that there’s a datatype weirdness on the ViewFields parameter! The Add method is expecting System.Collections.Specialized.StringCollection while the View object actually returns Microsoft.SharePoint.SPViewFieldCollection.
The type conversion works in PowerShell 3:
But does not work in PowerShell 2:
My workaround?
Use a handy method built into the Microsoft.SharePoint.SPViewFieldCollection type: ToStringCollection().
I could also have created the StringCollection object and copied the strings over using ForEach.
So why did it work in PowerShell 3 and not PowerShell 2? No idea! I’m guessing the “smarts” behind type conversion has improved. While the two collection objects are different (SPViewFieldCollection includes a .View property), the Items collection of both contain simple Strings.
.
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!)
When you click EDIT LINKS you can add a new item to the menu by clicking the (+) button.
Then there’s the trick! Drag the new link just under the parent link. (I’ll drag this one under the “Subsite1” link.)
Click Save and now you have dropdowns!
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:
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.
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
.
Subscribe to:
Posts (Atom)
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
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:
and what are they doing in my library?
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 |
c:0!.s|forms%3amembership | Only O365 | |
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/10/2016
SharePoint: I Just Love Consistency! SharePoint, Not So Much
SharePoint 2016 is so similar to SharePoint Online / Office 365 that it’s sometimes hard to tell which version you are in. I just ran across an odd change from the past versions. How do you share or break inheritance on a list item?
The steps are different and the end results are different. And I thought 2016 was supposed to be SharePoint Online brought onsite.
SharePoint 2013
- Shared With is available in the ITEMS ribbon and the ribbon of the View Properties page.
- The “…” menu has a Shared With option:
- The above link takes you to the Shared With popup.
SharePoint Online / Office 365
- Shared With is available in the ITEMS ribbon and the ribbon of the View Properties page.
- The “…” menu has a Share option:
- The above link takes you to the Shared With popup.
SharePoint 2016
- Shared With is grayed out in the ITEMS ribbon, but is available in the ribbon of the View Properties page.
- The “…” menu has an Advanced popout that has a Manage Permissions option:
- The above link takes you to the user.aspx Permissions page.
I write training materials and really wish I was paid by the word or page! These detail differences waste hours and complicate training!
.
SharePoint: Undocumented Pending Shares Page
Article applies to SharePoint 2013, SharePoint Online and SharePoint 2016.
Did you ever wonder after using the Share buttons in SharePoint if the Site Owner ever responded to your request, responded with a question, or approved the request?
The My Permissions page
As I can’t find any documentation, I’ll call this undocumented for now… After a bit of web searching I did find a mention of the page in an Ignite presentation. In any case, this page lists the status of pending requests and lets the user who made the request check and send messages to the site owners. Requests that have been approved or declined will not be listed here.
The site owner can see your requests by going to Settings (gear), Site Settings, Site Permissions and clicking “Show access requests and invitations”. This will take them to the Access Requests page at _layouts/Access%20Requests/pendingreq.aspx.
You can check your pending requests by going to:
http://yourDomain/sites/yourSite/_layouts/mypermissions.aspx
This link will redirect to /_layouts/15 for now and may change in future versions.
Of course, no one knows about this page. There are no out of the box links to it. And… the site owner will probably not know to click the “SEND” button to start a conversation with the person who made the request.
If “Sharing” is important in your organization, you will need to provide some training, easy access to a link to the MyPermissions page, and do some work to “drive adoption”.
Details:
- Only “Pending” requests are displayed. Approved requests are not.
- You can click the “…” to see messages from the site owner, or to send a message to the site owner.
- This pending invites listed are unique to the current site. I.e. each site has its on MyPermissions page.
.
3/08/2016
SharePoint PowerShell Training for Auditing and Site Content Administration
If you have followed this blog, you know that I’m kind of a SharePoint nut who’s also a PowerShell nut. Over the years I have created a lot of PowerShell scripts while working with SharePoint and answering questions in my classes and in the TechNet forums. There’s plenty of resources for installing and configuring SharePoint using PowerShell, but there’s little on dealing with all of the daily questions on premise admins get that can be quickly answered using PowerShell. I was just going to take my 100+ scripts and create something like a “cookbook”, but instead created a class. The class handout kind of ended up as the cookbook… 85 pages and 175 sample scripts, or maybe more like a giant PowerShell cheatsheet for SharePoint.
This class is for on-premise SharePoint 2010, 2013 and 2016 administrators. A SharePoint Online version is in the works, but not available yet.
If you would like to attend this class, delivered by the author (your’s turely!), we are offering it next Monday, March 14th, at MAX Technical Training in Cincinnati, Ohio. You can attend this class at MAX or remotely from anywhere. If you can’t attend this class, it is available from trainging centers all over the world.
March 14th class at MAX: SharePoint 2010 and 2013 Auditing and Site Content Administration using PowerShell
Search for this class at other training centers: https://www.bing.com/search?q=55095%20powershell
If you would like to see some of the other courses and books I’ve written, then click here.
55095 SharePoint 2010 and 2013 Auditing and Site Content Administration using PowerShell
This one day instructor-led class is designed for SharePoint 2010 and 2013 server administrators and auditors who need to query just about anything in SharePoint. The class handout is effectively a cheat sheet with over 175 PowerShell scripts plus the general patterns to create your own scripts. These scripts cover:
- using the SharePoint Management Shell and the ISE
- general tips for counting, reformatting and exporting results;
- drilling up and down the SharePoint object model
- getting lists / inventories of servers, services web applications, sites, webs, lists, libraries, items, fields, content types, users and much more
- finding lists by template type, content type and types of content
- finding files by user, content type, file extension, checked out status, size and age
- finding inactive sites
- finding and changing SharePoint Designer settings and finding and resetting customized pages
- inventorying and managing features
- deleting and recycling files and list items
- inventorying users and user permissions and finding out “who can access what”
- creating sites, lists and libraries
- uploading and downloading files
- and much more…
At Course Completion
After completing this course, students will be able to:
- Use PowerShell to query just about anything inside of SharePoint.
- Understand the core SharePoint object model and object hierarchy as seen from PowerShell.
- Format PowerShell output in to reports.
- Manage resources to limit the impact on production servers.
- Create and delete Site Collections, subsites, lists, libraries and content.
Prerequisites
Before attending this course, students must:
- Very good knowledge of SharePoint and its features.
- Good experience using PowerShell 2 or later or recent completion of a PowerShell class such as 10961 or 50414.
Course Outline
Module 1: SharePoint and PowerShell
This module provides an introduction to the topics covered in the class, introduces SharePoint PowerShell terminology and provides a review of important PowerShell features.
Lessons:
- History of PowerShell in SharePoint
- PowerShell vs. Search
- PowerShell, SharePoint Management Shell and cmdlets
- Security and Permissions Needed
- Getting Started with PowerShell: Counting Items, Custom Columns, Reformatting Numbers, Saving Results to a File
- Changing and Updating Content: Creating SharePoint Objects, Changing Objects
Lab:
- Using PowerShell with SharePoint
After completing this module, students will be able to:
- Get started using PowerShell to inventory and update SharePoint.
Module 2: Working with SharePoint CMDLETs and Objects
This module introduces the SharePoint object model and some important terminology.
Lessons:
- GUIDs
- Sites vs. Webs
- The SharePoint Object Hierarchy
Lab:
- Get a list of all Site Collections and their GUIDs
- Get a list of all Webs in all Site Collections
- Given a web’s URL get its parent web and web application
After completing this module, students will be able to:
- Explore sites and webs using PowerShell.
- Retrieve important properties of common SharePoint objects
Module 3: Managing Memory and Limiting Performance Impact
This explores limiting impact on server memory usage and performance.
Lessons:
- Memory Management and Disposing Objects
- Limiting Impact on Production Servers
Lab:
- Exploring PowerShell’s use of system memory.
- Testing the impact of scripts on server performance
After completing this module, students will be able to:
- Recognize and manage the impact of PowerShell on a SharePoint server.
Module 4: Working with Content
This module explores SharePoint using PowerShell from the Farm down to individual list items.
Lessons:
- Getting Farm Information: version, services, services, features
- Getting Web Application information
- Exploring Site Collections: retrieve Site Collections, Site Collection Administrators, quotas
- Working with the Recycle Bins: finding items, getting file counts and bytes, deleted sites
- Exploring Webs: web templates, finding webs, finding webs based on template, Quick Launch and Top Link Bar navigation
- Exploring Lists and Libraries: finding all lists, lists by type, lists by Content Type, columns/fields, document count by web or library
- Exploring Content Types
- Finding documents: by a word in the title, file type, content type, size, date age, checked out status, approval status and many more…
- Deleting content
- Downloading and uploading files
Lab:
- Explore the farm.
- Inventory site collections.
- Create a recycle bin report.
- Finding all blog sites.
- Find all picture libraries.
- Find all PDF files over 5 MB.
- Delete all videos in a site collection.
After completing this module, students will be able to:
- Explorer, inventory and maintain SharePoint content using PowerShell.
Module 5: Users and Security
This module covers the use of PowerShell to explore and document SharePoint permissions.
Lessons:
- Users: find a user, get a list of all users, working with Active Directory groups
- SharePoint groups: Get lists of groups, get the members of a group, find all groups a user belongs to, find the groups associated with a web
- Expanding users lists that include Active Directory groups
- Documenting Broken Inheritance / Unique Permissions: webs, lists, libraries, folders, items
- Working with Role Assignments
Lab:
- Get a list of all users who have access to a Site Collection.
- Get a list of all groups in a Site Collection.
- Get a list of all groups a user belongs to.
- List all users who may have access to a SharePoint securable.
- Get a list of all securables with broken inheritance.
After completing this module, students will be able to:
- Explore and document users and user permissions.
- Explore and document SharePoint groups.
- Explore and document broken inheritance.
Module 6: Managing Sites
This module explorers Site Collection and Web management from PowerShell.
Lessons:
- Finding Inactive Webs
- Creating and Deleting Site Collections
- Getting Site Collection Data
- Creating and Deleting Subsites
- Working With SharePoint Designer Settings
Lab:
- Create a report for inactive sites.
- Create a site collection and subsites.
- Delete a site.
- Delete a site collection.
- Disable SharePoint Designer in all site collections.
After completing this module, students will be able to:
- Manage SharePoint Site Collections and webs from PowerShell.
Audience
- SharePoint server administrators.
- SharePoint auditors.
- Also valuable for SharePoint developers.
2/21/2016
Hide the Attachments Link in a SharePoint Form
The problem… While we do want site visitors to see the list items, we don’t want them to see or click the list’s attachments.
More Site Owner articles.
More articles about the SPSecurityTrimmedControl
One approach is to use CSS and a handy SharePoint control. You could also write a JavaScript solution. Here we will look at the CSS option.
Note: This is not security! This is hiding some HTML using CSS. Users can right-click and select View Source to discover the text hidden by the CSS.
General pattern:
- View the DispForm.aspx page (the view properties popup in SP 2010) for an item in the list.
- Press F12 to open the IE Developer Tools.
- Use the Internet Explorer F12 panel’s Select Element button to discover an appropriate tag and ID that could changed by CSS to show/hide the content. (For this example it happens to be “idAttachmentsRow”.)
- Edit the DispForm.aspx page using SharePoint Designer.
- Add CSS to hide the tag from everyone.
- Add a SharePoint control with additional CSS to unhide the content for users with at least the Edit permission. Set the SharePoint control to only display its content for people who can edit list items.
The SPSecurityTrimmedControl
The magic here is that the SPSecurityTrimmedControl can selectively display content based on a user’s assigned permission. As an example, users with the Read permission level do not have the EditListItems permission while members and owners do. Note that the control can only be set to a single permission, not a Permission Level or group.
More detailed steps:
- Open SharePoint Designer and your site.
- Click Lists and Libraries and your list.
- Click the DispForm.aspx file.
- In the ribbon click Advanced Mode.
- Find the PlaceholderMain Content tag (<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">)
- Add the following block of HTML just after that tag.
- Save your changes and test.
SharePoint 2010 (and probably 2007) version:
<style type="text/css"> #idAttachmentsRow { display:none } </style> <Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="EditListItems"> <style type="text/css"> #idAttachmentsRow { display:inline } </style> </Sharepoint:SPSecurityTrimmedControl>
SharePoint 2013 and SharePoint Online / O365 (and probably 2016) version:
<style type="text/css">
#idAttachmentsRow { display:none !important }
</style>
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="EditListItems">
<style type="text/css">
#idAttachmentsRow { display:table-row !important}
</style>
</Sharepoint:SPSecurityTrimmedControl>
A list of the PermissionsStrings can be found here: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx
More about using SPSecurityTrimmedControl can be found here: http://techtrainingnotes.blogspot.com/2009/07/sharepoint-run-javascript-based-on-user.html
.
2/20/2016
If you have not finished your SharePoint 2013 Dev Certs… better get to work!
Microsoft is “expiring” a long list of exams in September.
You may also want to see:
Azure Exams 70-532, 70-533
and 70-534 Getting an Update!
More certification articles.
- Anyone working on the related certifications has six months to complete these exams, or never be able to finish certifications they have been working on.
- Anyone wanting these certifications better get started ASAP.
- Time to review your study and training plans and budgets!
- You should review the rest of the “Expiring exams list” to see what else is going away, and check this list periodically . (dates currently range from March to Sept 2016.)
- New certifications, exams and classes are going to be announced soon.
These certifications are Impacted. (The tests for them expire 9/16.)
- MCSD: Windows Store Apps Using HTML5 (481, 482, 490)
- MCSD: Windows Store Apps Using C# (484, 485, 491)
- MCSD: SharePoint Applications 2013 (488, 489, 517)
These exams are going away in September:
- 481: Essentials of Developing Windows Store Apps Using HTML5 and JavaScript
- 482: Advanced Windows Store App Development Using HTML5 and JavaScript
- 484: Essentials of Developing Windows Store Apps Using C#
- 485: Advanced Windows Store App Development Using C#
- 488: Developing SharePoint Server 2013 Core Solutions
- 489: Developing SharePoint Server 2013 Advanced Solutions
- 490: Recertification for MCSD: Windows® Store Apps using HTML5
- 491: Recertification for MCSD: Windows Store Apps using C#
- 492: Upgrade Your MCPD: Web Developer 4 to MCSD: Web Applications Examination
- 499: Recertification for MCSD: Application Lifecycle Management
- 517: Recertification for MCSD: SharePoint Applications
Links:
- https://www.microsoft.com/en-us/learning/retired-certification-exams.aspx
- https://borntolearn.mslearn.net/b/weblog/archive/2016/02/16/exam-retirement-update-what-39-s-retiring-in-september-2016
- https://borntolearn.mslearn.net/b/weblog/archive/2016/02/18/additional-details-on-upcoming-exam-retirements
- https://absolute-sharepoint.com/2016/02/microsoft-retiring-sharepoint-mcsd-developer-exams.html
- https://absolute-sharepoint.com/2016/02/microsoft-replacing-sharepoint-dev-certifications-office-365.html
.
1/03/2016
“Unable to display this Web Part” after XSLT Customization
The following applies to SharePoint 2013, 2016 and SharePoint Online.
The Error
“Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.”
The above error shows up in SharePoint 2013 and later when doing multi-level grouping with Data Form Web Parts. With the removal of many of the design features from SharePoint Designer 2013, I doubt there are too many people creating new XSLT customization. But if you are upgrading from 2010 or trying to implement a 2010 style customization then you many run into this error.
The Cause and the Fix
If you dig into the error logs you will find that this is reported as “Error while executing web part: System.StackOverflowException”. Turns out though that it is a timeout of the XSLT parser and has been around for quite a while. The fix is pretty easy, if you are on premises, just run a tiny PowerShell script from the SharePoint Management Shell.
$farm = Get-SPFarm$farm.XsltTransformTimeOut = 10
$farm.Update()
Some of the articles say to increase it from the default of 1 second to 5 seconds. In my test environment I typically needed to increase it to 10 seconds. If you monitor the CPU on the server you will see that at least on lab-type virtual machines that a page load where you have this issue does put quite a load on the CPU.
SharePoint Online? No joy for you! It appears that the default is 1 second, and you can’t change it.
There’s been a number of articles on the topic, mostly in the SP 2010 world:
http://thechriskent.com/tag/xslttransformtimeout/
and many more: http://www.bing.com/search?q=xslttransformtimeout+sharepoint
.
1/01/2016
Views.Add() Cannot find an overload for "Add" and the argument count: "8".
I wrote a PowerShell script to create views. It worked in PowerShell 3 on SharePoint 2013. It failed in PowerShell 2 on SharePoint 2010.
To play it safe, I copied values from an existing view to insure the correct data types…
$web = Get-SPWeb http://sharepoint/sites/training
$list = $web.lists["Announcements22"]
$v = $list.views[0]
$list.Views.add("TestView",$v.ViewFields,$v.query,30,$true,$false,$v.Type,$false)
As I can count to 8 (usually) and I made sure the data types were correct, I then wasted a lot of time google/binging the error message.
So I then did the obvious thing for a developer, I fired up Visual Studio. And… found that there’s a datatype weirdness on the ViewFields parameter! The Add method is expecting System.Collections.Specialized.StringCollection while the View object actually returns Microsoft.SharePoint.SPViewFieldCollection.
The type conversion works in PowerShell 3:
But does not work in PowerShell 2:
My workaround?
Use a handy method built into the Microsoft.SharePoint.SPViewFieldCollection type: ToStringCollection().
I could also have created the StringCollection object and copied the strings over using ForEach.
So why did it work in PowerShell 3 and not PowerShell 2? No idea! I’m guessing the “smarts” behind type conversion has improved. While the two collection objects are different (SPViewFieldCollection includes a .View property), the Items collection of both contain simple Strings.
.
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!)
When you click EDIT LINKS you can add a new item to the menu by clicking the (+) button.
Then there’s the trick! Drag the new link just under the parent link. (I’ll drag this one under the “Subsite1” link.)
Click Save and now you have dropdowns!
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:
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.
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 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 | |
|
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 |
.