title: Rename Sharepoint folder using ClientContext
body: <p>been stuck for this for a while. I need to rename a SharePoint folder using ClientContext. I created a function like so:</p>
  
  <pre><code>Public Function renameFolder(_folders As ListItemCollection, _newFolderName As String) As Boolean
      Try
          Using _clientContext As New ClientContext(vSharepointSite)
              AddHandler _clientContext.ExecutingWebRequest, AddressOf vClaimsHelper.clientContext_ExecutingWebRequest
              Dim _folder = _folders(0)
              _folder.Item("Title") = _newFolderName
              _folder.Item("FileLeafRef") = _newFolderName
              _folder.Item("DisplayName") = _newFolderName
              _folder.Update()
  
              _clientContext.ExecuteQuery()
  
          End Using
          Return True
      Catch ex As Exception
          Return False
      End Try
  End Function
  </code></pre>
  
  <p>This function takes a folder collection (actually I pass a collection of only 1 folder) and the new folder name. The function executes well. Inspecting the <code>_folder</code> after the <code>ExecuteQuery</code>, everything looks as expected. However nothing happens in SharePoint, meaning that the folder name remains the original name.</p>
  
  <p>Any suggestions?</p>
  
  <p>Best regards and....HAPPY NEW YEAR!!!!
  Ariel</p>