Posts

SharePoint Online: Elevated Permissions....with love

Image
Remember the good old days! when using RunWithElevatedPrivileges(SPSecurity.CodeToRunElevated), in the SharePoint server-side object model, would let us run our code (Full trust code) with full control i.e. granting us higher permission (as System Account) and letting us performs tasks that waren't permited to do in current user context.  Now, that, we have SharePoint addin and SharePoint online webparts, one still wonders if there is still a way of achieving that. Since there are use cases where a user needs a higher permission, for instance.  Changing a status of a field in a list where the current logged in user has read only permission.  Reading member of a SharePoint group.  In Workflows  like SharePoint Designer workflow you used to have App step, in Nintex workflow you have elevated permission and in MS Flow Impersonation is possible using connectors in Flow triggered by HTTP request can run under System account as show in the video below:  Other way of achieving that is  I

SPFx: Develop using SharePoint Framework without Installing all the dependecies.

Image
SharePoint Framework (SPFx) has been around for more than 5 years now with being Generally available since Feb 2017.  In the recent times, its been possible to develop webparts for SharePoint on-prem as well using SPFx and with that it is getting harder to maintain multiple versions of required toolchains. e.g. Node. For M365 you can use the latest version of SPFx but probably you know, if you aim to develop webparts for the SharePoint Server 2016 platform, for instance, you need to use the SharePoint Framework v1.1.0 due to the server-side version dependencies. So yet another challenge is using the correct version of the SPFx and Nodejs for the particular project . Although I personally used to like Node Version Manager which lets you manage multiple installations of node.js on a Windows computer but still one needs to isolate SharePoint Framework dependencies if you are targeting multiple platform from on PC. 2nd Problematic scenario begins when you start developing SPFx extension i

Powershell: Filling up an Existing Excel Sheet with data from SQL Server

Situation: The client required to have data from their SQL Server 2012 Database filled in to an existing Excel Sheet. This sheet had a table with around 40 columns of which 12 where to be filled by us and rest from different departments. I tried different solution for that since the requirements were not initially clear. Forexample OPENROWSET was tried. In this regards this link really helpful. Although this requires few configuration to be made on the server or to install e.g. ACE.OLEDB driver on server which was not possible in our case. So we decided to write a Powershell script and access SQL Now about the script: Take the file TestExcel.xlsx from C:\Temp folder Create its copy with the current date appended to its name.  Start reading the Excel file from Sheet "Specified Sheet Name" From Columns 1, it will take the name of the system.  Based on the name fill the excel sheet by executing the queries, here are the columns that are going to be filled:  #   

Per-user throttling in SharePoint Online: a Recipe for getting blocked in SharePoint Online and way to Avoid it

Image
Suppose you have a CSOM or REST API based code that connects with your SharePoint online Site.  This code tends to update several fields including metadata of a number of files in a document library in complex manner.  Or  Try, for instance, creating site collection in Pnp Powershell using "New-SPOSite" serveral times.  Or  Someone decides to Load test SharePoint Online site.  These are some of the use cases as well which you can can find on Miscrosoft documentation given in the rederence below.  Now you will notice, if you run into aforementioned situation, at certain point that SharePoint Online will return HTTP status code 429 i.e. Too many requests or 503 i.e. Server Too Busy (an HTTP response status 503 on Windows server means Service Unavailable.) and requests will result in failure. Furthermore, if one continues with one's transgressions i.e. keeps on running the script, as warned by Microsoft, the script will eventually exceed its usage limits and SharePoint Onlin

SharePoint 2013/2016: Deleting All List Item Using Powerhshell

SharePoint Online: Site Asset Provisioning Programatically

Image
Love it or hate it, for any given requirement, Microsoft always comes up with multiple solutions i.e. there are more than one ways of achieving a goal.  So in case of assets provisioning such creating site columns, Content types and list etc. on a SharePoint Online programatically, developers got following ways:  Provision SharePoint assets from your SharePoint client-side web part So the idea is when you develop your SPFx webpart, provision your site columns, content types and List along with it.  SharePoint site template and site script Site scripts are rather JSON files comprising of an ordered list of site objects such as site column, content types lists, site logo etc . This script can be applied to the site using the on site using site setting and apply Site template option or you can use POwerShell and Rest APi as well.  Create a Content Type using PowerShell : Pnp PowerShell can be used to create site column, content types and lists.  Of course there are other ways as well such

SharePoint 2013: Profile Pictures not showing in User Information List

Scenario: Refer to  this post for the scenario. Here there can be other reasons as well for example check out your my sites hosting location. There can be a situation that somebody in the past changed the location of My site as in my case it was changed 3 times. Resolution: If you are facing similar sort of problem then first you should verify the following: Are the profile picture uploaded in the first place? for that you may want to check inside Manage User Profile in User Profile Service Application.  Does the Profile picture appear on the my site of the user? Visit the user profile and also check out User Photos under my sites.  If the photos do exist in User Photos Library then perhaps you can  $web=Get-SPWeb "http://SharePoint/" $list= $web.SiteUserInfoList $user=$web.Ensureuser("User's display name") $listitem=$list.GetItemById($user.Id) $listitem["Picture"]="http://my/User Photos/Profilbilder/cellent_Name_MThumb.jpg"