Posts

Showing posts from August, 2017

SharePoint People Search with custom AD Properties

Image
If you have a custom AD property and it is mapped to user profiles, but if you would like to search people with that property, you should follow the SharePoint search syntax. The syntax is PropertyName:Value   Ex: DeskNumber:D005 Problem with this is that You must follow the syntax You can not search for part of the value, it should be full-text value. Quick Solution: There is a quick tricky solution to come out of this drawback. 1. Open People search page (as administrator) 2. Click Edit page from settings gear. 3. Edit the People Search Core Results web-part 4. Click Change query button 5. In the Query text box:  Put all of your combinations: starts with, end with etc., with OR/ AND logical conditions. contentclass=SPSPeople {searchboxquery} OR MyCustomProperty1:A{searchboxquery} OR MyCustomProperty2:{searchboxquery}A OR MyCustomProperty1:{searchboxquery}  OR MyCustomProperty1:AB{searchboxquery} 6. Click OK, save and che

SharePoint page layout with default html in RichHtmlField

Image
Here is my previous post  Create SharePoint Page and redirect to the page with edit mode Also check,  How to open files/documents in SharePoint document library is new tab Here is one of the scenarios I had come across, where in I had to create a custom page layout and a RichHtml field in it should have a pre-filled layout of html table with 2 columns. You need to add your html to the Html attribute of the RichHtmlField control: <PublishingWebControls:RichHtmlField         AllowDragDrop="true"         ID="AnnouncementBody"         FieldName="FF268335-35E7-4306-B60F-E3666E5DDC08"         Html= "<table cellspacing='0' width='100%' class='ms-rteTable-default' style='height: 172px;'> <tbody> <tr> <td class='ms-rteTable-default' style='width: 25%;'>​​​ </td> <td class='ms-rteTable-default' style='width: 75%;'> </td> </tr> <tr&g

Create SharePoint Page and redirect to the page with edit mode

I recently found one of our clients struggle in creating a page in pages library. The process follows like this: Go to Pages library New Document Enter page name, description, select layout Click create. ->creates the page and redirects to the default view of the library. Search for the page you have just created, open the page Edit the page using the ribbon. So if you could see the struggle to create a page and reach to the edit page. So client asked me to simplify this. I found a stack-overflow post very useful and this blog post is inspired by that stack-overflow post. Solution: Put this code in a js file and refer this file in your master page. $(document).ready(function () {  var currentAddress = window.location.pathname;     if (currentAddress.toLowerCase().indexOf('/createpage.aspx') == -1) // not the creation page page         return;     $("input[id$='buttonCreatePage']").each(function () {         // The OK button    

How to open files/documents in SharePoint document library is new tab

As you know documents in SharePoint document library (images, pdf files etc) always opens in the same page and it leaves you from the SharePoint context. You can not go back to SharePoint from that page unless you press the back button of your browser. Here is a fix/workaround for this problem. Put below code to a js file and refer this file in your master page.  try {               //Below code is for opening document library files(pdf,jpg) in new tab         // has to be on an interval for grouped doc libraries         // where the actual links are loaded only once a group         // is expanded         setInterval(           function () {               $("a[onclick*='return DispEx'][target!='_blank'][aria-label$='pdf File'],a[onclick*='return DispEx'][target!='_blank'][aria-label$='jpg File']")                 .attr("target", "_blank")                 .removeAttr("onclick");