This article discusses how to create a timer job for deleting orphaned users (SharePoint users that are deleted or disabled in AD) using Visual Studio. I have tested this solution on both SharePoint 2016 and SharePoint 2010. So, it would of course also work for SharePoint 2013.
SharePoint
This is where I log all things SharePoint. I have worked on various versions of SharePoint. So, each post will usually specify what version I'm talking about (some times, the post will apply to pretty much all versions). Beyond SharePoint, this section may also hold content pertaining to other related Microsoft technologies like Office 365, Azure, C# (C Sharp), PowerShell, etc.
PowerShell script to delete SharePoint orphaned users
Orphaned users in SharePoint are users that have been disabled or completely deleted from active directory but are still referenced in list items and sites, and especially in the SharePoint people picker control. This article explains how to remove them using PowerShell.
Converting asynchronous SharePoint event receivers to synchronous
If you encounter the edit properties box on single document uploads and still want to run custom code in the ItemAdded event receiver, you will need to employ the method discussed in this article of converting asynchronous SharePoint event receivers to synchronous. The motivation behind this post was to avoid save conflict errors. But there are potentially other scenarios where it might be useful to make asynchronous SharePoint event receivers synchronous.
Adding fields to SharePoint lists with the AddFieldAsXml method
If you perform any automated website or list/library creation in SharePoint, you would at one point or another need to define and add fields (SPField) via code using the AddFieldAsXml method of the SPFieldCollection class. This article focuses on a few “gotchas” you may encounter while working with this method.
Setting default column values on items added to a SharePoint folder using code
Depending on the folders into which items are uploaded in SharePoint, you may want to set default column values so that instead of a global column default value, your default values become folder-specific. This article demonstrates how to do this using C# code on a SharePoint 2016 server. The code can be added to event receivers to keep child items updated when something changes somewhere.
Credential encryption and security in MOF files
PowerShell desired state configuration scripts often request user credentials which then need to be stored in some form in the output MOF files. Since you never want to save passwords as clear text, this article explains how you can keep passwords secure and encrypted inside your MOF files.