A very common requirement for SharePoint developers is to assign out of the box and/or custom SharePoint permission levels to sites (SPWeb objects) or lists and document libraries (SPList objects) or even list items (SPListItem objects).
SharePoint Developers often need to add a custom action to the SharePoint edit control block (ECB). I have had to do this many times myself and since there isn’t a lot of resources available on the subject, I decided to write this post for those who might want to do this sometime, and for myself as a future reference.
For quick reference: C# and PowerShell code snippets to grab the SharePoint central admin url for a farm.
Generally, you would use RunWithElevatedPrivileges to elevate permissions and execute a block code as the application pool account. But this doesn’t work nicely in console apps.
Very often, developers need to execute some code in the context of another user. This article explains how to do SharePoint user impersonation with C# using the Server-Side Object Model (SSOM).
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.