Skip to main content


Maintaining Multi-line text format in Angular

In my earlier post, I had discussed about maintaining multi-line text format in AngularJS view. In this post, I'll share how to achieve the same in Angular. What I have described in this post is tested in Angular 7.

To provide a context, let us say you are creating a page using Angular and rendering data from a SharePoint list/library. One of the columns is multiple lines of text with rich text enabled. The objective is to display the rich text as it is.

In AngularJS, we created a custom filter and used that filter in the HTML element.

In Angular, it is pretty easy. Angular already provides [innerHTML] property to handle such cases. Let's look at an example.

<p [innerHTML]="description"></p>

Here, "description" is a property in Angular component which holds the value of a multi-line text column.

If you are thinking if it is safe to use this, check the Angular documentation on security (yes, it is safe!)
Recent posts

Update on Posts and Comments

I have seen many comments in last several months asking questions on some of the posts. First of all, I apologies for not responding on time. I had set email to receive notification for new comments but for some weird reasons, I was not getting mails at all. Since I did not check for new comments in the site itself, I did not even know that there were comments, so I could not respond to your questions.

I'm trying to fix this notification issue. Meanwhile, I'll keep checking in the site itself for any new comments.

Also I have observed, there were plenty of spam comments in the site. I had kept posting comments open but looks like spammers have taken the advantage of it for their product/service marketing. It took quite a bit of time to individually delete all the spam comments. Going forward, all the comments will be moderated. That means, it will not be published immediately. I hate to do this but this is the only way to filter spam comments. I'll also make sure to check…

UnauthorizedAccessException while checking If user is part of a Group

To check if a user is part of a group programmatically, we can use this end point:


   type: "GET", 
   url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getbyname('groupName')/users?$filter=Id eq " + userId, 

   headers: {"accept": "application/json; odata=verbose"}, 
   success: function(data){
     // Success logic 
   error: function(error){ 


When you execute this code, and (if) you get the below error

Access denied. You do not have permission to perform this action or access this resource
Navigate to the group, go to Group settings, and ensure "Who can view the membership of the group?" to "Everyone".

By default, only the Group Owner can view the membership of a Group. That means, the above code works if the logged in user executing the code is the group owner. For everyone else, it throws…

Announcement of SharePoint 2019

The last month, Microsoft announced the strategy, vision, and timeline for SharePoint 2019.

From the screenshots provided, it is evident User Experience has improved. Though the article has listed the key features, we have to wait to experience what changes SharePoint 2019 brings to the users.

SharePoint 2019 is available to the customers in second half of this year. Preview should be available to the customers soon.

Check this article for details.

Filter on Date column of a Calendar List using REST API

In SharePoint 2013 on-premises site, if you are trying to apply a filter on EndDate column (or EventDate column) of a Calendar List using REST API, it throws the below error.

The field 'EndDate' of type 'DateTime' cannot be used in the query filter expression.
Basically we cannot use EndDate column in the filter query. That sounds weird but it looks to be a "miss" from the SharePoint product team.

However, it is interesting to note that this filter works fine in SharePoint Online (SPO). So the sample query like below returned valid items.

https://domain/sites/pub/_api/web/lists/getByTitle('Calendar')/items?$select=Title,EndDate&$filter=EndDate lt '2018-05-31T23:59:00Z'

So, the Product team might have fixed the issue in SPO. Hope this should be resolved at least in SP2016.

Send items to Recycle Bin using REST

When we have to implement Delete operation using REST API, we normally use the straightforward method to delete an item or a document. For example, to delete an item from a List, we use the following code.

 type: "POST", 
 url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('CustomList')/items(2)", 

 headers: { 
   "accept": "application/json; odata=verbose",
     "IF-MATCH": "*",
     "X-RequestDigest": $("#__REQUESTDIGEST").val()

 success: function(data){
     alert("Item is deleted!");
 error: function(error){
     alert("Error"); console.log(error);


To delete a document from a Library, we use the below code.

 type: "POST", 
 url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/getfilebyserverrelativeurl('/sites/pub/Documents/DocIcon.png')"…

How to check User permission using REST

Though SharePoint handles security trimming throughout the site, sometimes when you need to create custom pages and controls, you would need to check the permissions of the logged in user to allow/block certain actions. For example, only if a user has permission  to edit list items, show Edit button. So how do you check if the logged-in user has the required permission or not?

SharePoint provides a REST endpoint "effectiveBasePermissions". Using this endpoint, you can check if the user has required permission or not.

THE URL syntax is: [Domain]/[Site]/_api/web/lists/getByTitle('ListName')/effectiveBasePermissions.

Interestingly, this endpoint returns data as JavaScript Object Model (JSOM) object. So to use this data, you would need to load two libraries sp.runtime.debug.js and sp.debug.js. These libraries are available at 15 hive folder.

Let me show you the complete code (jQuery should be loaded for this code). This code is tested in SharePoint Online and it should …