Skip to main content

Posts

Showing posts from March, 2018

Security Trimming and REST

Security trimming is an important feature in SharePoint. The permissions defined in a site is "respected" throughout the site including the APIs. So once you define a permission, wherever you navigate, the permissions are applied and accordingly you will (not) see the data. What does it also mean that if you are using REST API to fetch data from a SharePoint site, the API returns data with security trimmed. So you don't have to apply any additional filter to the query. The same query might return 10 items for one user, 20 items for another user based on the user's permission on items. Also, let us say, you are trying to get a list of Apps (Libraries and Lists) from a site using REST and you are displaying that on a page. Also assume that you have not given permission to 5 out of 10 Apps to the user "User A". How many Apps User A get to see in a page? It's not 5 but all. Remember, this is similar to the case where user navigate to Site Contents pag...

How to fetch value from Rich Text editor using jquery

When we use multi-line text in SharePoint List, Rich Text Editor will be rendered on List forms. If you ever need to apply a custom validation on this control, you would need to fetch values programmatically. So how can we fetch value from a rich text editor. As a first step, open the List form using SharePoint Designer. Replace the control ID (eg., ff1) with a custom name. Let us say Desc. Every rich text editor is basically a "contenteditable" DIV. We cannot use ID completely. So we need to use wildcard and also use role attribute which is always "textbox" for rich text editor. So your jQuery code looks like this: $("[role=textbox][id*='Desc']").html(); By using role attribute and the field name, you are assured of getting the value of a multi-line text field.