Skip to main content

Posts

Microsoft M365 Fundamentals Certified

Finally! I'm M365 Fundamentals certified!
Recent posts

Notable changes in List in SharePoint Online

The moment you create a List in SharePoint Online there are quite a few notable changes which catches our attention. Let me provide a quick list of those changes. AllItems View In AllItems View, we don't see ribbons any more. Instead there is a menu which has all the required actions for a List. Columns can be added right from the view itself. This is really useful considering it minimizes steps to create columns. We can also change the order of column display in the view by simply dragging a column. What I also noticed is the List view has ajax implemented. If someone adds an item to the list, it automatically refreshes in my screen. I liked this feature. List Settings List Settings option is available under "gear icon". It took a while to figure this out. So the options available in gear icon is contextual. If I'm not in a List view, this icon will not show me "List Settings". Versioning Settings Now If you enable versioning, it is mandatory to set the num

Update on SharePoint Posts

Now it's more than a decade in SharePoint technology. I had a privilege to work in many areas within and around SharePoint and in various domains solving business problems. Though, I'm still working on SharePoint, I have also developed an interest in Machine Learning. From the blogging perspective, my current focus is on ML concepts and programming. I find the ML programming different from traditional programming which I have been doing. There is a learning curve and I'm enjoying it. I have created a separate blog space to share my ML journey . I do not have plans to stop writing on SharePoint, but definitely the frequency may reduce substantially  I would continue to write on SharePoint Online and related technologies. 

Get User Id using REST or JavaScript Object Model

Sometimes you would need to fetch the User Id based on either Login name or Email id. You would need User Id if you need to assign a user object to a people picker control or People/Group field. How do we get the Id based on Email or Login Name in client side development? We can achieve that using JavaScript Object Model or REST API. Let me share the first example using JavaScript Object Model (JSOM). var context = new SP.ClientContext.get_current(); this.user = context.get_web().ensureUser(loginName or Email); var o = { d: d, user: this.user }; context.load(this.user); context.executeQueryAsync(     Function.createDelegate(o, ensureUserSuccess),     Function.createDelegate(o, Fail) ); The above code fetches User Id for a given Login Name or Email Id. Interestingly, there is no equivalent endpoint available in REST! The Microsoft documentation talk about a endpoint but I could not get it working. So what is the way to get User Id using REST? You have to use the hidd

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!)

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 ch

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: $.ajax({     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){       alert("Error");       console.log(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 401 System.UnauthorizedAccessException 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 gro