CRUD operations on Provider Hosted SharePoint Add-In to Azure SQL Database

Hi All,

This post is about connecting a SharePoint provider hosted add-in deployed on Azure to a Azure SQL DB for performing basic CRUD operations.


  • Microsoft Azure account.
  • Office 365 account
  • Visual Studio 2015/2017 with SharePoint extensions.
  • A empty provider hosted add-in with ACS mode created and deployed on an Azure web app.


  • Create Azure SQL DB:
    • Within Azure portal, click New –> Databases –> SQL Database
    • Enter SQL server details.



  • Update DB server firewall to allow client IP access to the DB
    • Go to list of DBs in Azure, select the current DB – Select ‘Set server firewall’
    • Hit ‘Add client IP’ and then hit Save button.



  • Modify Provider hosted add-in to create model  from newly created DB:
    • Within project, go to Project –> Models –> Right click add new item. Select ADO.NET Entity data model from Data tab.
    • Select EF Designer from Database option to choose model contents
    • Provide correct Azure connection details to establish the correct connection with newly created Azure SQL DB.
  • Modify Provider hosted add-in to create controller from newly created DB:
    • Within project, go to Project –> Controllers –> Right click add controller 


  • Next add link in the layouts page for user to click from the application.


Next when running the SharePoint App, and clicking Customers link, you should be able to see all the data on the screen as shown below:


SharePoint 2013 MySite page opening blank for a single user

Sharing another live project issue that I faced with one of my customers..

A single user when trying to open SharePoint 2013 Mysite page, was getting a blank page. This was happening on some other Mysite pages also.

Also user was sometimes receiving error:

System.ArgumentException: calType
at Microsoft.SharePoint.Utilities.SPIntlCal.GetLocalCalendar(SPCalendarType calType)


  • Go to My Site Settings in Central Administration
  • Edit the user profile for the user having the issue
  • The setting for ‘Set your calendar’ would be blank
  • Set this to a value like – Gregorian
  • Save the profile
  • User would be able to access the My site pages.

SharePoint 2013 Quick Edit link disabled

Hi All,

Many times we see that the ‘Quick Edit’ link in the Ribbon is disabled even when we are the Site collection Administrators / Owners.


Following could be the reasons why it is being disabled.

  1. Custom Style applied on the view – Quick edit only works with a view set on default style. If you change style to any other than default, Quick edit option will be disabled for everyone.
  2. Quick Edit not enabled for the list in Advanced Settings within List Settings.
  3. Current view of the list has Group By enabled and applied on some field.
  4. Allow individual item checkbox not checked on Tabular view in the view.

It could be any one of these reasons, why Quick edit is showing up as disabled.

Making SP O365 Site collection Read Only

Hi All,

In On-Premise SharePoint version, we do have an option of Site Quota and Locks using which we can make a site collection Read Only.

This can be very useful in the scenario of migration of a site as well.

However with O365 version of SharePoint, we do not have the direct way of making a site collection Read Only, but we do have an alternate approach that includes Creating a Read Only policy, and then applying that policy.

Sharing the same below:

  1. Browse to the site collection that you want to make Read Only
  2. Go to Site Settings -> Site Collection Administration -> Site Policies


3. On the Site Policy page, hit Create link

4. Give your policy a Name, Description (Optional), Select the following options:

  • Do not close or delete site automatically
  • Check the option – The site collection will be read only when it is closed
  • Hit OK and the policy will be created.


5. This will create a Read only policy that will be applied when the site is closed (temporarily closed).

6. Next step is to close the site after which the Read Only policy will be automatically applied.

7. Go to Site Settings -> Site Administration -> Site closure and Deletion -> Hit Close this site now.


8. Once the site is closed, you will see a site Read Only banner (in pink) on top of the site.


9. If users browse the site, it will be Read Only. Site Admins can go and re-open the closed site and it will be again available for users to add and update.

Also, there is an option in O365 using PowerShell to set the site collection with No Access to anyone. This may be used to temporarily lock down the site with No Access.

The following PowerShell commands may be used for the same.


PS C:\work\CSOM-EnableFeature> Set-SPOSite
sites/TestSiteTemplate -LockState NoAccess
PS C:\work\CSOM-EnableFeature> Set-SPOSite
sites/TestSiteTemplate -LockState Unlock
PS C:\work\CSOM-EnableFeature>

Full Control Rights User (Owners Group) cannot create sub sites

Sharing a live issue in one of our SharePoint 2013 application.

A user who is part of Owners group on a SharePoint site (having Full control), is not able to create subsites. When they do they receive an error “Sorry, you don’t have access to this page” or “Access Denied”.

If they are added as Site collection Administrator, they are able to successfully create subsite.


Looking at the ULS logs, the following error appears:

SPRequest.UpdateField: UserPrincipalName=i:0).w|s-1-5-21–4218016322-16051, AppPrincipalName= ,bstrUrl=http://projects-wst.***.com/****/collab/pt/rfq/ ,bstrListName={E8F681E0-C8AB-4454-9C52-376AADCB7112} ,bstrXML=<Field Type=”TaxonomyFieldTypeMulti” DisplayName=”HashTags” StaticName=”HashTags” Name=”HashTags” ID=”{333b1bc2-0532-4872-96f1-bbbdead35a56}” Description=”****” SourceID=”{2e9ba01e-b042-49ce-8993-e16635268252}” List=”{c442bc26-f509-4ec7-9da0-a8fe0234924e}”

On finding the name of the list mentioned in the error log, it appears to be SharePoint Taxonomy Hidden List. This list can be reached through UI by appending the URL Lists/taxonomyhiddenlist



This hidden list’s permissions should have Full Control (Owner) group added. However there was no user / group added to the list permissions. It was not inheriting security.

Administrators may have stripped these hidden lists using a PowerShell command during a process to clean up permissions on the site collection in staging, preparing it for a migration to their production server.

The permissions were broken (Unique permissions were applied on the list).


Just inheriting the permissions got back Owners group added to the list.

Now when Owner group users tried creating the subsite, it got created successfully.