Saturday, May 21, 2016

Sort Search Results in SharePoint 2013


One of the requirements for the project was to roll up data from a list that’s sorted by Name, Relevance  and Last Date modified in descending order.

In previous versions of SharePoint, the out-of-the-box search results provided links to show results by relevance or modified date. Now, with SharePoint 2013, the results may be sorted by any managed property but there are a few preset values. However, by default, the sort option is not enabled. So to allow your users to sort search results, follow these simple steps:

1) Edit one of the results pages in your search center site and Edit the Search Results web part:



2) To add the JSON go into the search results web part properties, expand the “Settings” toggle and enable the “Show sort dropdown” option. We can get rid of all the predefined sort orders and insert our own :

 
Our Query  :
[{"name":"Relevance","sorts":[]},
{"name":"Name","sorts":[{"p":"DocTitle","d":1}]},
{"name":"Date Modified","sorts":[{"p":"Write","d":1}]}]

The sort options are controlled by the JSON in the Available sort orders text box. You may modify this to add or remove sort options. Feel free to choose from any of the 600+ managed properties available out-of-the-box.

What does the JSON mean?

eg : Sort according to Name and Location
Let’s format the JSON to get an understanding of what’s going on here. 



The “name” property is the display name that you will see in the search drop down. Even though we’re not displaying the search drop down in our Web Part you can still give it a meaningful name.
The “sorts” property contains our sort order for the search results. The “p” is the managed property name and the “d” defines whether descending order is true or false (1 is descending and 0 is ascending).

3) Click OK in the toolpane and check-in the changes of the page.

4) Perform a search. A drop-down appears above the results:



How To add a managed property

1.      Verify that the user account that is performing this procedure is an administrator for the Search service application.
2.      In Central Administration, in the Application Management section, click Manage service applications.
3.      Click the Search service application.
4.      On the Search Administration page, in the Quick Launch, under Queries and Results, click Search Schema.
5.      On the Managed Properties page, click New Managed Property.
6.      On the New Managed Property page, in the Property name box in the Name and description section, enter the name of the new managed property. You can also enter a description.
7.      In the Type section, select one of the following options for the property:
o    Text
o    Integer
o    Decimal
o    Date and Time
o    Yes/No
o    Double precision float
o    Binary
8.      In the Main characteristics section, select one or several of the following:
o    Searchable
o    Advanced Searchable Settings (optional, if Searchable is selected)
o    Queryable
o    Retrievable
o    Allow multiple values
o    Refinable
o    Sortable
o    Alias
o    Token Normalization
o    Complete Matching
Important :
If you want to be able to use this managed property as a refiner, you must select both Refinable and Queryable.
If you want to use this managed property for sort, you must select Sortable 

9.      In the Mappings to crawled properties section, click Add a mapping.
10.  On the Crawled property selection page, select a crawled property to map to the managed property and then click OK. Repeat this step to map more crawled properties.
11.  On the New Managed Property page, in the Mappings to crawled properties section, specify if you want to include:
o    All content from all crawled properties mapped to this managed property
o    Content from the first crawled property that contains a value and, optionally, in which order.
12.  In the Company name extraction section, you can optionally select the check box to enable company name extraction.
13.  In the Custom entity extraction section, you can optionally select the check box to enable custom entity extraction. See Create and deploy custom entity extractors in SharePoint Server 2013 for the procedures.
14.  Click OK.


To edit a managed property

1.      Verify that the user account that is performing this procedure is an administrator for the Search service application.
2.      In Central Administration, in the Application Management section, click Manage service applications.
3.      Click the Search service application.
4.      On the Search Administration page, in the Quick Launch, under Queries and Results, click Search Schema.
5.      On the Managed Properties page, find the managed property that you want to edit, or enter its name in the Filter box.
6.      Point to the managed property that you want to edit, click the arrow, and then click Edit/Map property.
7.      On the Edit Managed Property page, edit the settings and then click OK.
 

Sunday, April 3, 2016

Configure Incoming and Outgoing e-mail for SharePoint2013 with Exchange2013 - Part 1


Part 1 : Incoming Email Setup

Configure incoming email through SharePoint setting so users can email directly to lists and libraries without opening  SharePoint list and libraries. It's a time saver for end user, rather than login into SharePoint and having to manually post or manually upload a document to SharePoint  you can do it through  the direct posting from  outlook(any other)  to SharePoint environment. List and libraries can be assigned unique email addresses so as a result of that end users can send emails even with attachments.
- If you are using the basic scenario, each SharePoint front-end web server must be running the Simple Mail Transfer Protocol (SMTP) service and the SharePoint Foundation web application service.
- If you are using the advanced scenario, you can use one or more servers in the server farm to run the SMTP service and to have a valid SMTP server address. Alternatively, you must know the name of a server outside the farm that is running the SMTP service and the location of the e-mail drop folder.


Note : It's possible to accomplish this without Exchange, but that approach doesn't provide the best end user experience.

End user will email through the  exchange server to the SharePoint server in order to do this we need to configure SMTP services on the SharePoint server. SharePoint has no way of accepting  emails from Exchange. It doesn't have mechanism to taking these emails and  putting them to list or libraries. SMTP service provides an ability to take emails from exchange server and put it into a library or list.
Then need to configure incoming email settings on the SharePoint server and we have to configure send connector on the exchange server.  Finally we have to configure a test list or libraries on the SharePoint site.

Step 1 :Install and setting SMTP :


Firstly you must be a member of the farm administrators group to configure an SMTP server.

Please follow the below steps to add SMTP role to the SharePoint Server.
1.       open central admin as Administrator and Click on "Configure incoming e-mail settings"



2.       Go to your server manager, click on "Add role or Features"



3.      Click on Next and choose "Select a server from the server pool" and click Next

4.      Here you need to check "SMTP Server" and finally install it.



5. To configure SMTP on SharePoint Server browse to Server Manager > Local Server > Tools> "Internet Information Services (IIS) 6.0 Manager". Expand Server Name >
     Right Click on SMTP and click on Properties



6.       Click on Access > Authentication and ensure Anonymous is checked


7.       Next click on the connection tab and confirm that "All Except the below list is checked"


8.       Now click on the relay button. "Only the list below" should be selected and confirm that "Allow All computers which successfully authenticate to relay, regardless of the list above"


9.       Now you can go to the Services and make sure SMTP service is running.
Click on run and type services.msc and scroll down to "Simple mail transfer protocol(SMTP)" open the properties and set it on automatic.


Step 2 : Configure Email Settings in SharePoint

1. Configure settings based on the screen shots


 

Step 3 : Create Send Connector :

1. Browse to Exchange console https://ExchangeServerName/ecp

2. Click on Mail Flow > Send Connectors


3. Click on New Send Connector Icon and give it meaningful name and chose Internal


4. Choose "Route mail through smart hosts" and click on Add and provide SharePoint Server FQDN


5. Choose None as the Authentication method


6. Provide the FQDN of the SharePoint Server where SMTP role is installed and click on Save and then Next


7. On the Source Server screen add the exchange server and click on Finish. Ensure that the Connector status shows as Enabled.

Step 4 : Enable Incoming email on Document library

1. Browse to your Web Application and create a new document library App. Then browse to the List settings of the Document Library App.
 

2. Click on Incoming e-mail settings.

3. Configure the settings based on the following screen shot



Step 5 : Test the incoming email functionality


1. Send an email with an attachment to the email address that you configured.
2. Navigate to the Drop folder on the SMTP server, default location for the drop folder is C:\inetpub\mailroot\Drop

3. You should see your emails sent in this folder.

4. Wait for 5 mins and these emails should get processed by the timer service.

5. Browse to the Document library and you should see the attachment being uploaded to the document library.