Rename git local/remote branches

Found this article — helped me a ton!

Rename a local and remote branch in git
If you have named a branch incorrectly AND pushed this to the remote repository follow these steps before any other developers get a chance to jump on you and give you shit for not correctly following naming conventions.

  1. Rename your local branch.
    If you are on the branch you want to rename:

git branch -m new-name
If you are on a different branch:

git branch -m old-name new-name

  1. Delete the old-name remote branch and push the new-name local branch.

git push origin :old-name new-name

  1. Reset the upstream branch for the new-name local branch.
    Switch to the branch and then:

git push origin -u new-name

Error: AADSTS65001: The user or administrator has not consented to use the application with ID ‘xxx’ named ‘SharePoint Online Client Extensibility Web Application Principal’

My genius co-worker helped me solve a tricky problem in Azure today.

Error: AADSTS65001: The user or administrator has not consented to use the application with ID ‘xxx’ named ‘SharePoint Online Client Extensibility Web Application Principal’. Send an interactive authorization request for this user and resource. Trace ID: dc1a52d3-6dfd-4a7e-9730-f9d347aa7600 Correlation ID: e48dce00-b9b1-4328-a13b-bd21bedb3f5a Timestamp: 2019-01-16 18:55:28Z


Another possible solution I have found is to revoke and re-add all permissions in the Azure AD management portal as well as the SharePoint API management portal.

Also this:

#spfx #sharepointonline #azure

PowerShell Multi-Threading!!!1

This guy gives a great overview of PowerShell multi-threading. It is step by step and chunked into nice sized pieces.  Thanks!


# create an array and add it to session state
$arrayList = New-Object System.Collections.ArrayList
$sessionstate = []::CreateDefault()
    (New-Object System.Management.Automation.Runspaces.SessionStateVariableEntry
	('arrayList', $arrayList, $null))
$runspacepool = [runspacefactory]::CreateRunspacePool(1, 2, $sessionstate, $Host)
$ps1 =
::Create() $ps1.RunspacePool = $runspacepool $ps1.AddScript({ for ($i = 1; $i -le 15; $i++) { $letter = Get-Random -InputObject (97..122) | % {[char]$_} # a random lowercase letter $null = $arrayList.Add($letter) start-sleep -s 1 } }) > $null # on the first thread start a process that adds values to $arrayList every second $handle1 = $ps1.BeginInvoke() # now on the second thread, output the value of $arrayList every 1.5 seconds $ps2 =
::Create() $ps2.RunspacePool = $runspacepool $ps2.AddScript({ Write-Host "ArrayList contents is " foreach ($i in $arrayList) { Write-Host $i -NoNewline Write-Host " " -NoNewline } Write-Host "" }) > $null 1..10 | % { $handle2 = $ps2.BeginInvoke() if ($handle2.AsyncWaitHandle.WaitOne()) { $ps2.EndInvoke($handle2) } start-sleep -s 1.5 }

Show Required Fields in Custom SharePoint Page Layout

This guy had a great solution for getting and displaying required fields on a SharePoint custom page.  Thanks!

showRequiredFields = function() {
    var context = new SP.ClientContext();
    var list = context.get_web().get_lists().getById(_spPageContextInfo.pageListId);
    var item = list.getItemById(_spPageContextInfo.pageItemId);
    fieldCollection = item.get_contentType().get_fields();

    context.executeQueryAsync(Function.createDelegate(this, success), Function.createDelegate(this, failed));

    function success() {
        var occurences = 0;
        var fe = fieldCollection.getEnumerator();
        while (fe.moveNext()) {
            var field = fe.get_current();
            var xmlSchemaString = field.get_schemaXml();
            var fieldXml = $.parseXML(xmlSchemaString);
            var fieldElement = fieldXml.getElementsByTagName('Field')[0];

            var required = fieldElement.getAttribute('Required');
            if (required != null && fieldElement.getAttribute('Required').toLowerCase() === 'true') {
                var displayName = fieldElement.getAttribute('DisplayName');
                $("[title='" + displayName + "']").closest('tr').children('').append(' *');

        if (occurences > 0) {
            $('#DeltaPlaceHolderMain').prepend('* = required'); } } function failed(sender, args) { console && console.log('failed. Message:' + args.get_message()); } }

Force Reset SharePoint Index / SharePoint Index Reset Timeout – SOLVED


  1. Stop the Windows SharePoint Services Timer service (Found in Windows Services)
  2. Navigate to the cache folder
  3. In Windows Server 2008, the configuration cache is in the following location:
  4. Drive:\ProgramData\Microsoft\SharePoint\Config
  5. Locate the folder that has the file “Cache.ini”
  6. Back up the Cache.ini file.
  7. Delete all the XML configuration files in the GUID folder. Do this so that you can verify that the GUID folder is replaced by new XML configuration files when the cache is rebuilt.
  8. Note When you empty the configuration cache in the GUID folder, make sure that you do not delete the GUID folder and the Cache.ini file that is located in the GUID folder.
  9. Double-click the Cache.ini file.
  10. Select the entire contents of the Cache.ini file and delete it, replacing all the text with the number ’1′. Save the file and close
  11. Start the Windows SharePoint Services Timer service
  12. Note The file system cache is re-created after you perform this procedure. Make sure that you perform this procedure on all servers in the server farm.
  13. Make sure that the Cache.ini file in the GUID folder now contains its previous value. For example, make sure that the value of the Cache.ini file is not 1.

Convert IEnumerable to CSV with an extension method

Found this useful tidbit for converting IEnumerable<T> to a CSV…

From the article:
” I started writing it, but then decided to Google with Bing, and found a decent direction to start with at Mike Hadlow’s blog. He didn’t include all the code in the post, but it saved me some typing, so thanks Mike!

namespace FooFoo
public static class LinqToCSV
public static string ToCsv<T>(this IEnumerable<T> items)
where T : class
var csvBuilder = new StringBuilder();
var properties = typeof(T).GetProperties();
foreach (T item in items)
string line = string.Join(“,”,properties.Select(p => p.GetValue(item, null).ToCsvValue()).ToArray());
return csvBuilder.ToString();

private static string ToCsvValue<T>(this T item)
if(item == null) return “\”\””;

if (item is string)
return string.Format(“\”{0}\””, item.ToString().Replace(“\””, “\\\””));
double dummy;
if (double.TryParse(item.ToString(), out dummy))
return string.Format(“{0}”, item);
return string.Format(“\”{0}\””, item);

Thanks Hansleman!