Posts

Showing posts from 2018

Permanently delete SharePoint Online Site-Collection

For SharePoint administrators, there was quite a radical change with the introduction of O365/SharePoint Online. One of the biggest changes for them were the limitations to the Administration Portal. The Central Admin allowed admins perform a plethora of admin tasks which were either not anymore allowed or were no longer available via the UI. Of course many admins did prefer the PowerShell route, some tasks were just easier via the UI. One such task that I have seen most admins perform via the UI was the deletion of a site-collection including the recycle bin. This is commonly done when a site provision failed and the same site needed to be provisioned again. However, deleting a site-collection was not enough. It was still in the recycle bin, and SharePoint was always smart to prevent you from creating another site-collection while a site with the same URL was present in the Recycle Bin. In on-premises, it is possible for admins to access the Recycle Bin via CA and delete the site

Quirks of uploading aspx files to a document library using SharePoint REST API

Uploading a file to a SharePoint document library using the SharePoint REST API can be very straight forward. Fast forward to  Microsoft Docs  and you are presented with all the information you need. A simple construct: Create a file and add it to a folder url : http : //site url/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/Files/add(url='a.txt',overwrite=true) method : POST body : "Contents of file" Headers : Authorization : "Bearer " + accessToken X - RequestDigest : form digest value content - length : length of post body Update a file by using the PUT method url : http : //site url/_api/web/GetFileByServerRelativeUrl('/Folder Name/file name')/$value method : POST body : "Contents of file." Headers : Authorization : "Bearer " + accessToken X - RequestDigest : form digest value X - HTTP - Method : "PUT" content - length : length of post b

C# Extension Methods

C#.NET comes with a lot of string processing methods like Substring , Compare , IndexOf , Replace , etc. Although the number and scope of such methods are vast, programmers still constantly have to rewrite similar text processing methods over and over again to suit their needs. Luckily we can extend on them and create all kinds of advanced string methods in C#. public string Replace ( string oldChar, string newChar) public string Replace ( string oldString, string newString) We will focus on Replace method here. In C#, Replace method has the following two signatures: Replace method does not give us the flexibility to replace after/from a specified position in a string or to replace for a specified number of occurrences within the string. This was possible in VB6. So, especially in migration projects there arises a need where we need to have extension methods of Replace. The signature of the extension methods we will create are as follows: public s