Thursday, July 25, 2019

O365 SharePoint - Duplicate Content Type

Scenario
  • You try to create a new sub-site from a template or try to create a new content type
  • Office 365 SharePoint Online (SPO) environment
Issue
  • Internal SharePoint validation identifies a duplicate Content Type
    • Typically this is due to a migration of content types or a failed feature activation/deactivation
    • Ex: "A duplicate content type name "Document Set" was found.
  • You cannot remove the duplicate Content Types because they are part of a feature or in-use
Resolution
  • Rename the duplicate Content Types using the Site Settings/Content Types interface
  • _hidden content types (like "System Media Collection") require using PNP PowerShell cmdlets to get the ID to pass into the browser URL
    $smc = Get-PnPContentType "System Media Collection"
    $smc.Id
    StringValue                                  TypeId
    -----------                                  ------
    0x0120D50067B20E13E9C3AA458AEF3A8392B641FD01 {da0f1e90-296f-480e-bc27-cefe51eff241}
  • Edit another content type and then replace the ctype query string parameter to edit the _hidden content type
    • Replace the following from the Document Set Edit Name Page
      /_layouts/15/ctypedit.aspx?ctype=0x0120D50067B20E13E9C3AA458AEF3A8392B641FD

Friday, August 17, 2018

Promoted Tiles - Popup Prior to Click

Scenario
  • You have a promoted tiles web part on a page
  • You need to prompt the user with a dialog box prior to navigating to the link on click
Issue
  • The onclick attribute is dynamically populated by the control, so it's hard to manipulate using Javascript or JQuery
Resolution
  • The key is to use the mousedown event instead.
    • Note: This will not support keyboard navigation so you may need to handle the keydown event as well.
  • Here is the code for the Script Editor.  Adapt the URLs for your environment
<script type="text/javascript" src="/SiteAssets/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/teams/print/SiteAssets/PromotedLinkPrompt.js"></script>
  • Here is the PromotedLinkPrompt.js code
console.log("PromotedLinkPrompt.js Loaded");

localStorage.setItem("PopupContentDone", "false");

function PopupContent()
{
var done = localStorage.getItem("PopupContentDone");
if (done == "false")
{
if (confirm("Does this work?\n\nClick OK to Proceed.\nClick Cancel for More Info.")) 
{
$(this).find("a")[0].click();
}
else
{
window.location = "http://www.votematrix.com";
}
localStorage.setItem("PopupContentDone", "true");
}
}

$(document).ready(function () {$("div .ms-tileview-tile-content").mousedown(PopupContent)});

Monday, August 6, 2018

Use a JSON file in a SharePoint Library

Scenario
  • You want to utilize a JSON file uploaded by an automated process to a SharePoint Document Library
  • In this case we will use the SiteAssets (Site Assets) document library in an Office 365 SharePoint Online (O365) site
Issue
  • If you use a direct path to the file you get the "Sorry, something went wrong"  "File Not Found." error
    • Ex: https://mycompany.sharepoint.com/sites/MySite/SiteAssets/MyFile.json
  • If you click on the file or get a link to the file you are given a URL to an AllItems display form which renders a file editor, but will not grant access to the JSON via script
    • Ex: https://mycompany.sharepoint.com/sites/MySite/SiteAssets/Forms/AllItems.aspx?id=%2Fsites%2FMySite%2FSiteAssets%2FMyFile%2Ejson&parent=%2Fsites%2FMySite%2FSiteAssets
Resolution
  • Using the Download button and Fiddler (or IE dev tools / network), you can identify the correct URL to access the raw JSON file.
    • Look for the HTTPS GET for download.aspx
  • Alternatively, you can use the following URL format and replace mycompany, MySite, and MyFile text with your own values:
    • https://mycompany.sharepoint.com/sites/MySite/_layouts/15/download.aspx?SourceUrl=%2Fsites%2FMySite%2FSiteAssets%2FMyFile%2Ejson
      • Note: This is for a site at /sites/MySite.  You may need to modify this path.
  • If using JQuery, here is some code to get it:
$(document).ready(function () 
{
$.ajax({
type: "GET",
url: "/sites/MySite/_layouts/15/download.aspx?SourceUrl=%2Fsites%2FMySite%2FSiteAssets%2FMyFile%2Ejson",
success: function(result)
{
            console.log(result[0].property1+ " - " + result[0].property2);
}
});
});

Wednesday, July 25, 2018

SharePoint Column Validation - Is Numeric

Scenario
  • You want the Title field to be an integer only.
Issue
  • The Title field cannot be typed as an integer using the standard list administration UI
  • The column validation in SharePoint is not straightforward
    • ISNumeric([Column Name]) does not work as it always sees the parameter as text
      • You have to add 0 to get a numeric value
Resolution
  • Use this format for the column validation to correctly identify an Integer
    • =IFERROR(INT([Column Name]+0)=[Column Name]+0,FALSE)

Tuesday, May 29, 2018

Microsoft tech support fails the open source community

Scenario
  • Open an O365 support ticket with Microsoft to notify them of a bug in their product.
  • Detail everything Microsoft needs to know to fix the problem in an email
    • In a recent case it was simply due to the Microsoft release engineer failing to deploy 2 files (CSS and PNG) from the Office 365 release to the CDN.
      • This effected tenants utilizing the CKEditor open source JavaScript class library, breaking the functionality for released web parts.  (Part of the SPfx 40)
Issues
  • Tier 1 support calls you and wastes an hour (or more) of your time making you go over the same steps provided in the email.
    • In the recent case it was literally as easy as clicking a link and getting a 404 error.
      • Here is the link to the Open Source product that Microsoft broke and the users who took the time to report it: https://github.com/OlivierCC/spfx-40-fantastics/issues/29
  • Tier 1 support says they can't support this because it is a programming issue and wants you to open a paid ticket to fix their own product issue.
Proposed Resolution
  • Microsoft needs a better way to escalate tickets from members of the community who are trying to help out and know what they are doing without having to go through tier 1 engineers or paid support.

Monday, May 21, 2018

OneNote Compliance, Records Management, and Governance - O365

Scenario
  • OneNote (part of the Office 365 suite of tools) is used to store information that may be considered records (official information)
  • Your compliance or governance teams may want retention, legal holds, or other policies configured on these records
Issues
  1. Mixed Content: OneNote notebooks contain mixed content with differing record policies.
    • Ex: Meeting minutes in one section, project info in another, and issues in a third section.
    • You cannot apply policies at the page level.
    • Note: This issue is the same as any other document containing mixed content (Word, Excel, etc.), however it is easier to use OneNote in this manner.
  2. Time Span: OneNote notebooks contain content spanning multiple days, months, or years
    1. This means disposition policies may not apply correctly, delaying or accelerating policy dates
  3. Legal Holds: Legal holds may inadvertently block an entire notebook from being editable
  4. Incompliant Locations: If  OneNote usage is discouraged or blocked, records are more likely to end up in  incompliant locations and users may experience broken integration features
    1. Incompliant alternatives: Notepad saved locally, Evernote, cell phone pictures and voice memos (Office Lens), emails, other online services, a personal OneDrive OneNote account, or a locally stored OneNote
    2. To avoid OneNote, users would also need to ignore the extensive OneNote integration features provided in Outlook, Windows, and the other Office products.
    3. There is not a good alternative note-taking tool that would better meet compliance policies.
Solutions

1. Mixed Content

OneNote notebooks with records should live in SharePoint, not in OneDrive or on a file share.
  • SharePoint allows for version tracking at the library level
    • Note: This is in addition to the limited OneNote versioning.
  • SharePoint also allows content policies to be applied at the section or Notebook level
OneNote notebooks with differing compliance policies should be split into separate notebooks
  • The policies should then be applied at the notebook level

2. Time Span

Notebook policies should be applied based on the parent SharePoint site policy whenever possible and should be defined based on the overall work being done. 
  • Example: A notebook for a project would last as long as the policy for the entire project.
  • Example: A team site notebook would expire when the team was disbanded.
  • Example: A department level knowledge-base notebook should not auto expire unless the department goes away.  A separate policy for archiving historical content can still be put into place.
Users can also be trained to export and archive specific content using any time frame required by your policies.  Users may automatically be assigned tasks to remind them to do this.
  • Example Policy: Meeting minutes should be exported quarterly to PDF format and minutes deleted from the notebook for the prior quarter.
  • Example: Project notebook should be exported yearly to XPS or PDF formats.

3. Legal Holds

For legal holds that block edits, records living in OneNote should be exported to an appropriate format (PDF, Word, etc.) and the hold should be applied to the exported document which would then be the official record and not block additional modifications to the entire notebook.  An alternative approach is to export the entire notebook and place a hold on the exported copy.  This issue applies to all document types that are actively used, but may be more impactful for OneNote if mixed content is contained in the notebook. 

4. Incompliant Locations

The best solution is to provide the user with compliant locations that are easy to use.  This can be done by provisioning SharePoint sites and OneNote notebooks for common records management use cases.  In this way, notebooks will already be split by appropriate policy groupings and correctly configured for versioning and compliance policies.

Restricting usage and adherence to best practices is the hardest to control and must be enforced through user training.  Some incompliant locations may be blocked by IT through firewall rules, but users can always get around these by using their own mobile devices.

Thursday, January 18, 2018

SharePoint Permissions Cheat Sheet

The following is a list of the default permission levels organized from greatest to least permissions and relating them in a concise hierarchical manner.  You can modify these however you want; but I recommend creating new permission levels instead or modifying the default permission levels in order to avoid confusion.  

Microsoft has grid versions of this, but this format is much simpler.
Permission level details are available here: Technet

Full Control - Owner
  • + Manage Hierarchy
  • + Design
Design
  • Apply Themes and Borders
  • Apply Style Sheets
  • Override list behaviors - checked out to other user
  • + Edit
  • + Approve
Manage Hierarchy - Hierarchy Managers
  • Override list behaviors - checked out to other user
  • Manage and Enumerate Permissions
  • View Web Analytics Data
  • Create Subsites
  • Manage Web Site
  • Manage Alerts
  • + Edit
Edit - Members
  • Manage Lists
  • Add and Customize Pages
  • + Contribute
Approve - Approvers
  • Approve Items
  • Override list behaviors - checked out to other user
  • + Contribute
Contribute
  • Add, Edit, Delete Items
  • Delete Versions
  • Browse Directories (explorer view)
  • Personal info, views, and web parts
  • + Read
Read - Visitors
  • Open Items
  • + View Only
View Only
  • View Versions
  • Create Alerts
  • View Application Pages
  • Self-service Site Creation
  • Browse User Information
  • Use Remote interfaces
  • Use Client Integration Features
  • + Restricted Read
    • -  Open Items
Restricted Read
  • View Items
  • Open Items
  • View Pages
  • Open web/list/folder
Limited Access
  • Browse User Information
  • Use Client Integration Features
  • Open web/list/folder


                                                            Friday, December 15, 2017

                                                            Managed Metadata multi-select values in SharePoint Designer Workflow

                                                            Scenario
                                                            • You wish to use the values in a multi-select managed metadata field in your SharePoint Designer 2010 or 2013 workflow
                                                            Issue
                                                            • Sometimes the workflow will fail when too many items are selected
                                                              • Ex: the term names plus GUIDs exceed 255 characters in the item / fieldname_0 results
                                                            • HTTP 500 Error in Workflow Information screen on 2013 workflows:
                                                              • RequestorId: GUID. Details: System.ApplicationException: HTTP 500 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["30"],"SPRequestGuid":["GUID"],"request-id":["GUID"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4667"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["Fri, 15 Dec 2017 22:29:51 GMT"],"Server":["Microsoft-IIS\/8.0"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
                                                            Resolution
                                                            • The list item field with _0 after it does support selections over 255 characters, but many Workflow Actions do not support fields larger than 255 characters.
                                                              • You cannot:
                                                                • Log to History List
                                                                • Set Workflow Variable of any types except "Multiple lines of text"
                                                                  • "Multiple lines of text" is only available from "Initiation Form" parameters
                                                              • You can:
                                                                • Email text
                                                                • Use "contains" operator in an If statement
                                                              • I have not gone further in my testing than the above, so please comment on any other actions you identify as working or not working.

                                                            Monday, November 20, 2017

                                                            Deploy JavaScript to a Site Collection or Web in Office 365 or On Premises + Dynamic Navigation Link

                                                            Scenario
                                                            • You have some JavaScript you'd like to inject into a page and want the simplest method of deploying it to all pages within a Site Collection or Web.
                                                            Issue
                                                            • You can do this via custom master pages, but then you break any future upgrades from Microsoft
                                                            • You can also do this via a Sandbox code solution, SharePoint Framework, or a SharePoint Add-In, but these are all overly complex for this simple task and may not work in some environments due to incorrect environment configurations
                                                            Resolution
                                                            • The simplest, fully supported way to do this is via a User Custom Action ScriptLink
                                                            • John Liu has a nice UI tool to simplify registering your code with each site/site collection
                                                            Example
                                                            • The following code example injects simple Javascript into each page to add a dynamic link to the left navigation menu (quick launch)
                                                            • I like to put these in Site Assets at the Site Collection root.  If you don't have a Site Assets library, you can create one by opening the site in SharePoint Designer and double clicking the Site Assets link.  You can also do this by enabling any feature that utilizes the Site Assets library.  Otherwise, you can use a different library that everyone can read from.
                                                            • You will need the following 3 files.  These should be saved into the Site Assets library at the site collection root site.
                                                            $(document).ready(function(){ 
                                                             //Fixes Chrome Scrolling problem and load of ECMAScript 
                                                             if (typeof(_spBodyOnLoadWrapper) !== 'undefined'){
                                                                 _spBodyOnLoadWrapper(); 
                                                                 
                                                                console.log('test');
                                                             MenuLastLI = $('#zz14_RootAspMenu li:last');
                                                             MenuLastLI.before('
                                                            <li class="static"><a class="static menu-item ms-core-listMenu-item ms-displayInline ms-navedit-linkNode" href="http://www.votematrix.com/"><span class="additional-background ms-navedit-flyoutArrow"><span class="menu-item-text">CUSTOM LINK</span></span></a></li>
                                                            ');
                                                             }; });
                                                            
                                                            • Click to open John Liu's configuration page (configure-page.aspx)
                                                            • Configure jQuery as Sequence 900 (so it loads first).  Install Site Collection.
                                                            • Configure JSTest.js as Sequence 2000 (Loads after jQuery)
                                                            • That's it.  The link should show on the left nav.

                                                            Tuesday, April 18, 2017

                                                            SharePoint 2016 Topology Planning

                                                            Scenario
                                                            • You are architecting an on-premises SharePoint 2016 Server Farm infrastructure deployment.
                                                            Steps
                                                            • If this is an upgrade, make sure you know what features were depricated
                                                            • Determine your server license requirements
                                                            • Determine if you need a scripted install or wizard install
                                                              • Scripted
                                                                • Utilize AutoSPInstaller (open source project) to create reusable installation scripts for easier re-provisioning of servers for multiple environments and disaster recovery scenarios
                                                                • More time to setup and initially more error-prone with greater possibility of misconfiguration and typos
                                                              • Wizard
                                                                • Simplified interface and best support from MS
                                                                • You should document in OneNote all settings chosen so you can reproduce exactly
                                                            • Determine if you can use MinRoles and decide which roles to use for which servers and how many servers you need
                                                              • MinRoles provide best practice configurations, are better supported by Microsoft, and are easier to redeploy using the wizard
                                                              • MinRoles cannot be used in certain large and specialized farm configurations
                                                              • Decide how many servers you need based on projected load and high availability requirements
                                                              • Decide which roles to use by reviewing them here: Technet - MinRole Planning
                                                            • Design SharePoint server topology using the roles and number of servers decided earlier
                                                            • Design SQL, Workflow Manager, and Office Online (previously Office Web Apps) server configurations

                                                            Tuesday, November 15, 2016

                                                            SharePoint 2013 - Redirect to View Item Form on New Item Save

                                                            Scenario
                                                            • You are saving a new record and want the user to be redirected back to the view item form to review the item.  This will allow the user to start a workflow or perform another action on the ribbon without the need to find the item in the list or library view.
                                                            • Need the solution to use JSOM (client side script) only.  
                                                            • Should work in Office 365, SharePoint Online, and On-Prem.
                                                            Issue
                                                            • By default, SharePoint redirects you to the List View you most recently came from.
                                                            • There is no out of the box setting for this.
                                                            Resolution
                                                            • We solve this by adding a redirect script to each list view page that does the following:
                                                              • Check if a new item was added by the current user.
                                                              • Check and create a short term cookie to determine if they have already been redirected for this item
                                                              • Redirect the user if they haven't already been
                                                            • First add the following Javascript file to your SiteAssests/js folder.  
                                                              • Create the "js" folder if it's not already there.
                                                              • Replace the ALLCAPS hard coded values with appropriate values.

                                                            SiteAssets/js/SP.RedirectOnAddItem.js

                                                            var siteUrl = '/sites/SITENAME';

                                                            function createCookie(name,value,minutes) {
                                                                if (minutes) {
                                                                    var date = new Date();
                                                                    date.setTime(date.getTime()+(minutes*60*1000));
                                                                    var expires = "; expires="+date.toGMTString();
                                                                }
                                                                else var expires = "";
                                                                document.cookie = name+"="+value+expires+"; path=/";
                                                            }

                                                            function readCookie(name) {
                                                                var nameEQ = name + "=";
                                                                var ca = document.cookie.split(';');
                                                                for(var i=0;i < ca.length;i++) {
                                                                    var c = ca[i];
                                                                    while (c.charAt(0)==' ') c = c.substring(1,c.length);
                                                                    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
                                                                }
                                                                return null;
                                                            }

                                                            function eraseCookie(name) {
                                                                createCookie(name,"",-1);
                                                            }

                                                            function RedirectOnAddItem() {
                                                            var clientContext = new SP.ClientContext(siteUrl);
                                                            var web = clientContext.get_web();
                                                            this.currentUser = web.get_currentUser();
                                                            clientContext.load(currentUser);
                                                            clientContext.executeQueryAsync(
                                                            Function.createDelegate(this, onUserQuerySucceeded),
                                                            Function.createDelegate(this, onQueryFailed)
                                                            );   
                                                            }

                                                            function onUserQuerySucceeded(sender, args) {
                                                                var email = this.currentUser.get_email();
                                                                var userid = this.currentUser.get_id();
                                                                var loginName = this.currentUser.get_loginName();
                                                                var clientContext = new SP.ClientContext(siteUrl);
                                                            var oList = clientContext.get_web().get_lists().getByTitle('LISTORLIBRARYNAME');       
                                                                var camlQuery = new SP.CamlQuery();
                                                                camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name = "ID" Ascending = "FALSE"/></OrderBy><Where><Eq><FieldRef Name="Author" LookupId="True"/><Value Type="User">' + userid  + '</Value></Eq></Where></Query><RowLimit>1</RowLimit></View>');
                                                                this.collListItem = oList.getItems(camlQuery);
                                                                   
                                                                clientContext.load(this.collListItem);
                                                                   
                                                                clientContext.executeQueryAsync(Function.createDelegate(this, this.onListQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));  
                                                            }

                                                            function onListQuerySucceeded(sender, args) {
                                                            var listItemInfo = '';
                                                            var listItemEnumerator = collListItem.getEnumerator();
                                                                   
                                                                while (listItemEnumerator.moveNext()) {
                                                                    var oListItem = listItemEnumerator.get_current();
                                                                    listItemInfo += '\nID: ' + oListItem.get_id();
                                                                    listItemInfo += '\nAuthor: ' + oListItem.get_item("Author").get_lookupValue();
                                                                    var diff = Math.abs(Date.now()) - new Date(oListItem.get_item("Created"));
                                                                    var minutesPassed = Math.floor((diff/1000)/60);
                                                                    listItemInfo += '\nCreated (Minutes Ago): ' + minutesPassed ;
                                                                   
                                                                    if (oListItem && minutesPassed < 2) {
                                                            //alert(listItemInfo.toString());
                                                            if (!(readCookie('PANnewID') == oListItem.get_id().toString())){
                                                            createCookie('PANnewID', oListItem.get_id().toString(), 2);
                                                            window.location = "/sites/SITENAME/Lists/LISTORLIBRARYNAME/DISPLAYFORMNAME.aspx?ID=" + oListItem.get_id();
                                                            }
                                                            }
                                                                }
                                                            }

                                                            function onQueryFailed(sender, args) {
                                                            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
                                                            }
                                                            • Finally, add the following code to a Script Editor web part on each List View page where the user would normally be redirected.
                                                            <script src="/sites/SITENAME/SiteAssets/js/SP.RedirectOnAddItem.js"></script>
                                                            <script type="text/javascript">ExecuteOrDelayUntilScriptLoaded(RedirectOnAddItem, "sp.js");</script>

                                                            Tuesday, July 26, 2016

                                                            Is SharePoint a true Document Management System (DMS)? Rumor explored.

                                                            In my 10+ years working with SharePoint I've heard 3 individuals declare that SharePoint isn't "a true Document Management system".  When questioned about this they bring up instances of poorly architected solution issues or performance limitations as the justification.  I too have experienced poor performance, bugs, limitations, and have inherited poorly architected SharePoint solutions; but my tendency is to address the underlying issues or engineer proper solutions rather than discounting the software out-of-hand.  This leads me to believe that there are some outdated primary sources for this rumor that were introduced outside of these users' own experiences.  This article will look into some of these sources, listing their bias.  I will also post some refuting articles.

                                                            Disclaimer: Obviously my bias is towards SharePoint as I am very familiar with its capabilities and have used it to implement more than 40 document management solutions with each one exceeding its unique requirements

                                                            Sources of Rumor (SharePoint is not a DMS)
                                                            • eFileCabinet - SharePoint competitor (2010)
                                                            • ContentVerse - SharePoint competitor (2014)
                                                            • Fishbowl Solutions - Oracle WebCenter SharePoint Connector provider (2012?)
                                                              • Has a good overview of the history of SharePoint issues pre-2010 but is mostly propaganda for keeping WebCenter and using their connector instead of migrating everything to SharePoint
                                                            • Reva Solutions - Alfresco (SharePoint Competitor) ISV (2015)
                                                            • DocFinity - SharePoint competitor
                                                            • Lexmark's In Context - Perceptive Software (SharePoint Competitor - now Lexmark) interview  (2011)
                                                            Refutations of Rumor (SharePoint is a DMS)
                                                            Conclusion

                                                            SharePoint (2007 or later) is a bonafide Document Management System with its own unique advantages and disadvantages.  The rumors appear to have been initiated by competing vendors as marketing propaganda from sources with limited knowledge of SharePoint's capabilities or from early reviewers who balked at the new technology and its use of third-party vendors for imaging and other advanced functionality.  It's fair to mention that SharePoint 2007 (pre-2010) was missing some of the more enterprise scale features of a DMS, but even those features were not mandatory to consider that version a "true DMS" as typically defined unless third-party products were excluded from use.

                                                            The closest you can get to the original rumor while maintaining the truth is that "SharePoint is not just a true Document Management System." Even the terms "Document Management System" and "File Management System (FMS)" are outdated.  "Enterprise Content Management System" (ECM, ECMS, or CMS) is now the preferred moniker to describe platforms that do more than just manage files and documents.  SharePoint, being one of the most widely used ECMs, benefits from the fact that it also takes on collaboration, intranets, extranets, (WCM) web content management, workflow, insights, enterprise search, and more.  It does so while maintaining one of the largest ISV (partner) communities of any ECMS, including most of the other ECM vendors who are struggling to maintain their relevance by integrating with SharePoint and Office 365.

                                                            This brings about the final argument against SharePoint, "it's not specialized only for document management, thus taking on too much and spreading too thin."  I agree that if the entire SharePoint team focused on just the DMS side, then it would be more feature rich in that area.  However, the true benefit of SharePoint over other DMSs is that it is a multi-tool that excels in many areas, each with fringe benefits to document management.  This is one of the primary reasons for the mass migration from single-focus systems to broader platforms.

                                                            Note: The meaning of "true DMS" is subjective, therefore if you define a "true DMS" to include a specific limitation (ex: Must be able to render historical versions in search without exposing the versioned documents in a library or folder - SharePoint Limitation), then you can justify your claim.  Just realize that anyone else can do the same to your preferred system (ex: Must provide secure co-authoring capabilities in a web-based note-taking client on MS, iOS, and Android mobile devices - available only with SharePoint).

                                                            Feedback?

                                                            Please contribute comments below listing specific features that your favorite CMS has which SharePoint may not.  I will do my best to provide feedback on its support within SharePoint.

                                                            Tuesday, July 19, 2016

                                                            Restricted Edit Event Receiver - SharePoint 2013

                                                            Scenario
                                                            • You need to restrict edits to a document library based on the current value of a field.
                                                            • Full trust farm solution for SharePoint 2013 scoped to Web.
                                                            Solution
                                                            • I created a configurable event receiver that will restrict edits (metadata and content) based on the value in one of the document's metadata columns.
                                                            • Additional feature: Delay implementation of the restriction for a number of seconds from Created Date to allow for additional automated processes to update new documents.
                                                            • Additional feature: Exclude a document from the restriction based on a regular expression using its  filename.
                                                            • Additional feature: Automatically populate the Title field (or other text field) based on another choice or text field.
                                                            • Open-Source code is available here:  RestrictedSave ZIP
                                                              • Feel free to modify and use this code.  You may not resell it or a modified version of it as part of a packaged solution without my permission.
                                                            • Disclaimer:  This will only prevent edits that trigger the item updating event receiver.  Some programmatic and 3rd party API calls made using bulk edit operations, workflow actions, or other event receivers may bypass the event receiver.  In addition, this code is not hardened for high security scenarios and is only meant as a first line defense against unwanted typical user edits.
                                                            Installation
                                                            • Download the RestrictedSave WSP file and deploy to your farm.
                                                            • Enable the Restricted Save feature on your sub-site.
                                                              • Feature Description:
                                                                Configured via the RestrictedSave list. If this site does not have one, a RestrictedSave list will be added. Document libraries named in the RestrictedSave list will not save a file if the user is unauthorized and the assigned column contains a certain value. If no required permission is specified, then the field can only be edited if the restricted column's value is changed. Multiple document libraries, columns, or values may be configured but must exist in this subsite. Optional New File Delay and Regular Expression Exclusion may be configured as well. Will also set the document title and/or filename based on a choice field by using the 'Title Choice Field' columns.
                                                            • Configure the RestrictedSave list that was added to the site according to your needs.
                                                            Example

                                                            • A standard configuration of the RestrictedSave list to restrict edits on a document library named "RestrictDeleteTest" when the "LOBType" column is set to "Choice 1".

                                                            • The resultant error displayed on a document's edit properties form in the "RestrictDeleteTest" library when a filename modification is attempted.


                                                            • Error Message in clear text
                                                            UNABLE TO SAVE! -- When column "LOBType" is set to "Choice 1" the item is locked and cannot be updated. -- Please work from a new copy or change the column value.





                                                            RestrictedSave List Configurable Fields
                                                            • Instructions are provided in-line on the form.
                                                            • Add one line for each restriction.  All lines will be parsed for each document edited in the sub-site.

                                                            --------------------------------------------------------------------------------------


                                                            And again in text format for search-engines, visually impaired, and copy/paste:

                                                            Document Library Name *


                                                            Column Name


                                                            Column Value


                                                            Required Permission To Edit

                                                               

                                                            New Item Delay Seconds


                                                            Title Exclusion Regex


                                                            Title Choice Field Name


                                                            Title Choice Target

                                                               

                                                            Thursday, July 7, 2016

                                                            Hacking the Datasheet View / Quick Edit in SharePoint 2013 to display in an IFrame

                                                            Scenario
                                                            • I created a document library list view in datasheet (quick edit) mode for display in a custom popup dialog in a SharePoint 2013 Visual Studio project "application page".
                                                              • This grid was used to make last minute changes to metadata values of selected items before continuing an existing process in a larger solution.
                                                            • I needed to display the list view using an IFrame pointing to a URL filtering the values by IDs.
                                                            • This was a large list exceeding the list view threshold
                                                            • I needed to hide all chrome, navigation, ribbon, and other elements surrounding the list view web part.
                                                            • I needed to call a JavaScript function outside the list view page from a button on the list view page.
                                                            • Note that I couldn't figure out how to convert the application page into a web part page which is why the list view web part is included via an IFrame rather than embedded directly into the page, however the same issues would apply except without the need for a hidden button or the chrome trimming.
                                                            • An alternative to using the list view web part in datasheet mode would be to use a datagrid control and manage the CRUD programatically, but this would be harder to maintain if the SharePoint schema changed down the line and would require much more coding to implement correctly.
                                                            Issues
                                                            • In Datasheet view the last record edited (or possibly the only record) will only save if you select another record (which you can't even do if there's only one record). This was an issue for 2 reasons:
                                                              • There was a custom button in the app that when clicked would continue the process without saving the record that was just edited.
                                                              • The stop editing functionality which would normally be used to save the last record resulted in a list view threshold error dialog due to a bug in the datagrid / Quick Edit mode when in a folder or using filter parameters and using the "Stop editing this list" link because it forwards to a standard view without the filter or folder.
                                                            Resolution
                                                            • Implementing the IFrame: A bug in Visual Studio .Net 4.5 framework IFrame web control requires the control to be instantiated manually in the code behind rather than automatically in the designer code file
                                                            protected global::System.Web.UI.HtmlControls.HtmlGenericControl iframe1;
                                                            • The IFrame was added to the application page like so:
                                                             <iframe name="iframe1" id="iframe1" ClientIDMode="Static" runat="server" height="400" width="400" seamless" />
                                                            • The IFrame was instantiated dynamically using server side code that set the filter parameters in the query string like so (itemids are in a semicolon delimited format):
                                                            iframe1.Attributes["Src"] = "/sites/SiteName/LibraryName/Forms/DatasheetViewName.aspx?IsDlg=1&FilterName=ID&FilterMultiValue=" + itemids;
                                                            • I hid a button (id = btnCopy style:display = none) on the application page which ran the application code and added the following JavaScript function to the application page so that it could be called from the list view page from within the IFrame.  Note the timed delay here as I'll explain this later.
                                                            <script type="text/javascript">
                                                                function triggerBtnCopyClick() {
                                                                    setTimeout(function () { document.getElementById('btnCopy').click(); }, 1200);   
                                                                }
                                                                
                                                                ....  existing code used by the application page that handled the btnCopy click event.
                                                            </script>
                                                            • I added a script editor web part to the Datasheet List View page and configured it to remove the chrome elements still remaining after IsDlg=1 did its work.  Note that your class names may be different based on the WPQ number (find using your browser's developer tools).
                                                              <style>
                                                              #s4-ribbonrow{display: none;}
                                                              #Hero-WPQ2{display: none;}
                                                              #CSRListViewControlDivWPQ2{display:none;}
                                                              </style>
                                                              • Finally, I added the button and code to call the parent page's triggerBtnCopyClick code.  You will need to find the GUID of your list view web part (webpartid) and plug it into the code.
                                                                This is the part that involved hacking the datasheet view by finding the function calls the "Stop editing this list" button used to save the final changes and reusing them in my own code.  The downside to this is that the grid needs to be refreshed afterwards and takes a second to finish processing so I added a 1200ms delay into the triggerBtnCopyClick function above that processes the code after the save.
                                                              <input type="button" id="SaveEdits" value="Save and Process" onclick="var gridInitInfo = g_SPGridInitInfo[('{WebPartID GUID HERE}')]; var ganttControl = window[gridInitInfo.controllerId]; var ganttControl = window[gridInitInfo.controllerId]; ganttControl.TryDispose(function(dlgReturnValue) {window.location.reload(false);}); this.style.display = 'none'; window.parent.triggerBtnCopyClick(); return false" />



                                                              Wednesday, June 1, 2016

                                                              SharePoint End Date on Workday using a Holiday List

                                                              Scenario
                                                              • Typical scenario where you need to add a certain number of days to a start date and set the due date to a working day (Ex: service window).  Note that this is not "number of working days".  It is "the next working day after X days".
                                                              • You can easily adapt this code to provide the last working day before X days.
                                                              • The working day must bypass weekends and holidays.
                                                              • You have a Holidays list in SharePoint that you can query.
                                                                • The Holidays list uses the out of the box "Holiday" list content type.
                                                                  • Note: In code, the "Holiday" "Date" field's internal name is "V4HolidayDate"
                                                              • You need to add some code to an event receiver or custom workflow action to get this date.
                                                              Solution
                                                              • This was coded for SharePoint 2013 but should work for other versions

                                                                     protected void MAIN_FUNCTION()  
                                                                     {  
                                                                       DateTime startdate = Convert.ToDateTime(START_DATE_VALUE).Date;  
                                                                       DateTime finaldate = startdate.AddDays(Convert.ToInt16(FINAL_DATE_VALUE));  
                                                                       SPList holidayLibrary = web.GetList("/Lists/Holidays");  
                                                                       Int16 CurrentHolidayIndex = 0;  
                                                                
                                                                       SPQuery query = new SPQuery();  
                                                                       query.Query = string.Concat(  
                                                                               "<Where><And><Geq>",  
                                                                                "<FieldRef Name='V4HolidayDate'/>",  
                                                                                "<Value Type='DateTime'>", SPUtility.CreateISO8601DateTimeFromSystemDateTime(finaldate) , "</Value>",  
                                                                               "</Geq><Leq>",  
                                                                                "<FieldRef Name='V4HolidayDate'/>",  
                                                                                "<Value Type='DateTime'>", SPUtility.CreateISO8601DateTimeFromSystemDateTime(finaldate.AddDays(14)), "</Value>",  
                                                                               "</Leq></And></Where>",  
                                                                               "<OrderBy>",  
                                                                                "<FieldRef Name='Date' Ascending='FALSE' />",  
                                                                               "</OrderBy>");  
                                                                       query.ViewFields = "<FieldRef Name='V4HolidayDate' />";  
                                                                       query.ViewFieldsOnly = true;  
                                                                       //Limited to 14 days of continuous holidays  
                                                                  
                                                                       while (IsWeekend(finaldate) || IsHoliday(finaldate, holidays, ref CurrentHolidayIndex))  
                                                                       {  
                                                                         finaldate = finaldate.AddDays(1);  
                                                                       }  
                                                                       OUTPUT_FIELD_VALUE = finaldate.ToShortDateString();  
                                                                     }  
                                                                
                                                                     bool IsWeekend(DateTime date)  
                                                                     {  
                                                                       if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday) return true;  
                                                                       return false;  
                                                                     }  
                                                                
                                                                     bool IsHoliday(DateTime date, SPListItemCollection holidays, ref Int16 holidayIndex)  
                                                                     {  
                                                                       for (; holidayIndex < holidays.Count; holidayIndex++)  
                                                                       {  
                                                                         DateTime holiday = Convert.ToDateTime(holidays[holidayIndex]["V4HolidayDate"]);  
                                                                         if (date == holiday) return true;  
                                                                         if (holiday > date) break; //stop checking once we pass the current date  
                                                                       }  
                                                                       return false;  
                                                                     }  
                                                                

                                                              Tuesday, November 3, 2015

                                                              SharePoint Saturday, Sacramento, 11/7/2015

                                                              My Presentation
                                                              Conference Link

                                                              Wednesday, August 12, 2015

                                                              SharePoint ParameterBinding the DateTime Control

                                                              Scenario
                                                              • You have a custom form providing values to an XsltListViewWebPart or similar List View Web Part that supports ParameterBinding.
                                                              • You need to provide a date picker control and would like to use the standard SharePoint control.  You only need the date, not time.
                                                              • You are using SharePoint Designer and may not have access to code blocks or other server side code.
                                                              • You are using the ParameterBinding in a CAML Query or similar.
                                                              Issue
                                                              • The SharePoint date picker control is easy enough to add directly to a SharePoint aspx page, but accessing the values from the Form or Control ParameterBindings are not straightforward.
                                                              Resolution
                                                              • Add JQuery and JQuery formatDateTime libraries to the page you are working on if they're not already included in your master page.
                                                                • Example where you have downloaded the jquery and formatDateTime files to the root Style Library:
                                                                  <script language="javascript" type="text/javascript" src="/Style%20Library/Scripts/jquery-1.11.3.min.js"></script>
                                                                  <script language="javascript" type="text/javascript" src="/Style%20Library/Scripts/jquery.formatDateTime.min.js"></script>
                                                              • Add the DateTime control followed by a standard TextBox element with the Same ID + "Value". 
                                                                • This extra TextBox control will be used to pass the value to the ParameterBinding and should be hidden.  You should specify the date you wish to use when a blank is entered (be sure to change both).  The OnValueChangeClientScript property is used to call the JavaScript function you will add next.
                                                                • Example:
                                                                  <SharePoint:DateTimeControl runat=server id="publishDateStart" OnValueChangeClientScript="spDateChanged('publishDateStart', '1901-01-01');" DateOnly="True"></SharePoint:DateTimeControl>
                                                                  <asp:textbox id="publishDateStartValue" runat="server" style="display: none;">1901-01-01</asp:textbox>
                                                              • Add the following JavaScript code.  This converts the DateTime control's date format to the format required by your XSLT CAML query and stores it in your hidden textbox.  It also swaps in a date for a blank.
                                                                •  Code:
                                                                  <script type="text/javascript">
                                                                  function spDateChanged(id, blankdate) {
                                                                  var datetimeID = '"_' + id + '_' + id + 'Date"';
                                                                  var dateSelected = $('[id$=' + datetimeID + ']:first');
                                                                  var dateSelectedValue = $('[id$="' + id + 'Value"]:first');
                                                                  if (dateSelected[0].value == "")
                                                                  {
                                                                  dateSelectedValue[0].value = blankdate
                                                                  }
                                                                  else
                                                                  {
                                                                  dateSelectedValue[0].value = $.formatDateTime('yy-mm-dd', new Date(dateSelected[0].value));
                                                                  }
                                                                  }
                                                                  </script>
                                                                  
                                                              • Set your ParameterBinding element to the TextBox Control's ID
                                                                • Example:
                                                                  <parameterbinding defaultvalue="" location="Control(publishDateStartValue)" name="AdoptedFrom"></parameterbinding> 
                                                              • Note that this example does not include the time elements since it was not needed in my use case and would add in some extra complexity to the function above.  This was written for a 2010 SharePoint Server.
                                                              • Also note that typed in entries need to be in the "m/d/yyyy" format.  Example: 1/1/2015
                                                                •  
                                                                   

                                                              Wednesday, May 13, 2015

                                                              SharePoint Saturday, Silicon Valley, 5/30/2015

                                                              My Presentation
                                                              Conference Link

                                                              Monday, May 4, 2015

                                                              My MS Ignite 2015

                                                              Day 1 - Monday
                                                              • Keynote (~23,000 attendees)
                                                                • SharePoint 2016 release not mentioned in the keynote!
                                                                • No mention of the SharePoint brand even though several new Office 365 SharePoint features were demoed
                                                                  • Does this mean MS is splitting off the SharePoint brand into its cloud use-cases: Office 365, Sites, OneDrive, Search, Delve, etc.?
                                                                    • Will SharePoint end up being rebranded as "Office 365 On-Prem"?
                                                                  • Or possibly an indicator of a lack-luster SharePoint 2016 release?
                                                                • Best newly demoed SharePoint/Outlook feature is the new email integration with attach file links integrated into Azure groups and SharePoint security
                                                                • Best Windows 10 demos were the Cortana Power BI demo and the facial recognition login demo
                                                                • Other stuff:
                                                                  • Skye for Business, Threat Analytics, Ops Management Suite, Azure Stack On-Premises, Windows Update changes, and the Surface Hub
                                                              • Evolution of SharePoint: Overview and Roadmap (over-capacity including overflow room)
                                                                • SharePoint 2016 = Office 365 On Premises
                                                                  • Basically most of what is already on or is coming to Office 365 SharePoint will now be made available on premises
                                                                • Deployment wizard will allow deployment by Role
                                                                  • WFE, App, Search, etc.
                                                                • Delve will be made available to SharePoint 2013 on-prem (soon?) 
                                                              Day 2 - Tuesday
                                                              • Power BI
                                                                • Live Dashboards
                                                                  • Drill into data
                                                                  • Ad-hoc BI
                                                                • Power BI Designer (client app)
                                                                  • Preview release version
                                                                • On-Prem Data Sources
                                                                  • Scheduled Refresh or Analysis Services Live Query
                                                                • API for data pushes / live monitoring
                                                                  • Demoed mobile phone accelerometer data live reporting
                                                                    • App used API to send data directly to dashboard
                                                              • Transforming your SharePoint Full Trust Code to the Office App Model
                                                                • Branding
                                                                  • Why brand collab sites?
                                                                  • Leverage Office 365 Themes
                                                                  • SharePoint Themes
                                                                  • CDM instead of Site Assets to avoid caching/blob cache issues
                                                                  • Use alternate CSS and javascript instead of modifying master pages when possible
                                                                • Provisioning
                                                                  • App/add-ins
                                                                  • Scripting
                                                                  • PnP Provisioning Engine
                                                                    • Security
                                                                    • Fields
                                                                    • TermGroups
                                                                    • Lists
                                                                    • Pages
                                                                    • Files
                                                                    • ComposedLook
                                                                    • Apply-SPOProvisioningTemplate
                                                                      • Will provision new items only, no updates
                                                                • Sandboxed Solutions
                                                                  • Still deprecated, should continue to n bb  work in 2016
                                                                • Script parts
                                                                  • Embedded javascript (node/jquery)
                                                                • Office 365 App Model
                                                                  • Mail, contacts, lists, libraries, and other Office 365 features
                                                                  • Standalone apps interface for ez app launch
                                                              Day 3 - Wednesday
                                                              • NanoServer
                                                                • Preview bits available
                                                                • No UI at all
                                                                • Remote Powershell and Managemen Console support
                                                                  • Limited cmdlet support, no local workflows
                                                                • Clustering and HyperV supported
                                                                • Fast boot, minimal services running
                                                                • Graphical remote management web based tool demoed
                                                                  • Works on all versions of Windows server
                                                                  • Process Manager
                                                                  • PowerShell window
                                                                  • System Settings
                                                                  • Device Manager
                                                                  • Event Viewer
                                                                • ServerCore will be renamed to Server
                                                                • Full Server/Server with a GUI will be renamed to Client
                                                                  • Not allowed in containers
                                                                • Visual studio server apps targeted to either Server or Nano, not Client
                                                                • Nano is simply a subset of Server, full compatibility for all features that are in both
                                                                  • You select features and drivers at deployment
                                                                • Demo of Chef deployment to Nano with Ruby, Python, and C# components
                                                                • More videos on channel 9
                                                                • Reduces attack surface and maintenance requirements
                                                                  • Fewer services, memory usage, patches, reboots
                                                                  • .4GB footprint compared to 4.84GB
                                                                • No MSI support
                                                                  • Nano Server installer in the works
                                                              • CRM Online and Office 365: What's New
                                                                • Integration Points
                                                                  • Outlook/Exchange
                                                                    • Email folder mapping of metadata
                                                                    • Create entities from email
                                                                  • Excel
                                                                  • Power BI
                                                                  • OneNote
                                                                  • Office 365
                                                                    • Groups integration
                                                                  • OneDrive
                                                                  • SharePoint
                                                                  • Yammer
                                                                  • Skype
                                                                  • Skype for Business
                                                              • Office 365 Groups -Eric Zenz
                                                                • Office 365 Group = SharePoint Site Collection
                                                                • Outlook and Office App integrations
                                                                • Groups include
                                                                  • Files
                                                                  • Group Notebook
                                                                  • Shared with us feed
                                                                  • Recycle Bin
                                                                  • Pages
                                                                • Delve provides insights into groups
                                                                • Future planned feature: Link groups to existing SharePoint sites
                                                                • Discovery works across group mail and group viles
                                                                • Coming in 2015
                                                                  • Guests membership
                                                                  • Dynamic membership
                                                                  • Data Leakage Prevention (DLP)
                                                                  • Quota management
                                                                  • Soft-delete
                                                                • Graph REST endpoint
                                                              • Line of Business Dev on Dynamics CRM (small room)
                                                                • Dynamics CRM
                                                                  • Line of business and Customer Engagement
                                                                  • Solution development
                                                                    • Relationship
                                                                    • Process
                                                                    • Interaction
                                                                    • LOB
                                                                  • Giving campaign demo
                                                                    • Theme
                                                                    • Personalized
                                                                    • Navigation
                                                                    • Office 365 Integration
                                                                    • Configurable
                                                                    • Social and Collaborative
                                                                    • Mobile Ready
                                                                    • Customizable Search
                                                                    • Secured
                                                                    • Analytical
                                                                • Build, Integrate, Manage
                                                              Day 4 - Thursday
                                                              • Best Practices for Design and Performance in SharePoint Online
                                                                • Branding Impact
                                                                  • Low Impact
                                                                  • High Impact
                                                                • Responsive Web Design
                                                                  • Limited support for some common collaboration site features
                                                                    • Ex: Gantt charts
                                                                • Composed Looks (Themes)
                                                                • Design Manager
                                                                  • Converts HMTL to Masterpage automatically
                                                                • Custom Branding
                                                                  • Use a starter masterpage
                                                                  • Layout with html css and imagers
                                                                  • Add SP Controls
                                                                • Performance considerations
                                                                  • Image sizes
                                                                  • SharePoint Online caching less reliable due to number of servers
                                                                  • Demo of custom rollup nav delaying page load
                                                                • Custom Masterpages will continue to be supported
                                                                  • Make sure to stay up to date with MS improvements
                                                              • Deploying Yammer
                                                                • Levi Strauss+
                                                                • Yammer Embed
                                                                • My Feed
                                                                • Group Feeds
                                                                • Liking
                                                                • Sharing
                                                                • Following
                                                              Day 5 - Friday
                                                              • BCS to SQL hybrid
                                                                • OData service on-prem exposes SQL data
                                                              • Search hybrid
                                                                • Search center on-prem or online
                                                              • Security
                                                                • AD sync
                                                                • DirSync server
                                                                  • Claims from User Profile Sync Service
                                                                  • Config steps
                                                                    • Add on prem domain to tenant
                                                                    • Activate DirSync in your tenant
                                                                    • Update DNS records
                                                                    • Run DirSync wizard and start sync
                                                                    • Check users and groups in Tenant Admin
                                                                    • Activate and License users
                                                                  • Validate synchronization
                                                                    • DirSync Troubleshooter App
                                                                • Azure AD Proxy on-prem manages ACS (Access Control Services) Trust
                                                                • ADFS + ADFS Proxy for single sign-on
                                                                • Configuring S2S
                                                                  • Replace STS Cert on all farms
                                                                  • Install S Sign in assistant and azure PowerShell
                                                                  • Register on-prem STS as Service Principle in 0365
                                                                  • Add SPN for on-prem domain
                                                                  • Register 0365 app principal as trusted provider
                                                                  • Set the auth realm on prem
                                                                • Validate User Profile Service App
                                                                • Search Validation
                                                                  • Result Source
                                                                    • ECB menu, click test source
                                                                  • Query builder
                                                                    • From Query Rules
                                                                  • Investigation
                                                                    • Partitioned search service or proxy not supported in hybrid
                                                                      • Fix: IgnoreTenatization
                                                                    • 400, 401, 403, 500 errors
                                                                • BCS Validation