Saturday, 28 February 2015

How to create result source in SharePoint

Result source is new in SharePoint 2013, using result source we can limit search results based on the search queries.

SharePoint 2010 search scopes are replaced by Result sources in SharePoint 2013.
In SharePoint 2013 provides 16 predefined results are given as shown in the below screen shot.



Local SharePoint Results are set to be a default result source we can also specify existing or custom newly created result source as default for a site collection or site.

To create a result source for a site collection.
Navigate to Site Settings->Search->Result Sources
Click on the Result Source there we can able to create a new result source.
In the General Information section Enter the name.
Click on the Launch Query Builder
By default we can able to see the screen shot shown below.
If you want to search only particular list items in our entire site using this result source.
In the Keyword filter “select only returns items” click on Add Keyword Filter.
In the Property Filter “Select the Path” Contains Manual Value Enter the List URL Click on Add Property Filter.
Click on Test Query we can see the Results Preview,
Keep the default setting as it is.
Click on Save.
Set as default resource source as shown.
Now if we search in our site we can get search results only in that particular list items in our entire site.

Moving User Profile Properties using PowerShell.

We created custom user profile properties in our SharePoint also we can check in our article How to Create Custom Properties in SharePoint.

 We want to move those properties to detail section in our SharePoint.
Using the OOTB feature we are moving UP by clicking the UP arrow, but some extend we are unable to move UP.  
There is way we can do using power shell.
Run the below script step by step.
Step 1:

$GetMySite = Get-SPSite <MySiteHostURL> #give here mysite url
$Getcontext = Get-SPServiceContext $GetMySite
$UserprofileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($Getcontext)

Step 2:
Here we can get all the properties with ID’s.
We can able to see our custom property with ID 5402.
When we are moving UP using OOTB UP arrow it was unable to go forward because of duplicate id will come when we are moving manually.



$userprofilemanager.properties | ft name,displayorder


Now we are  moving this to Detail section and also want to place after the SPS-Interests having the ID 5206.



Step:3

Now we will move the “Custom property test” after the Interests
We have to use only unique id so now using “5207"

$userprofilemanager.Properties.SetDisplayOrderByPropertyName(“CustomPropertyTest”,5207)
$userprofilemanager.Properties.CommitDisplayOrder()

finally reset the IIS once.

Now we can able to see the “Custom Property Test” in Details section without any issues.



Creating custom user profile property in SharePoint

To create a custom property in our SharePoint user profile service application.

Navigate to Central Admin->Application Management->Manage Service Applications->
Click on the User Profile Service Application.



Now Click on Manage User Properties.

There we can able see to create a New Property.

Click on the New Property
There I am entering the Name and Display Name as shown in the screen shot below.
Here we can change the length of the property and also Type as per requirement.
We can also change display settings and also change mapping to get the information from AD for this custom property also as per the requirement.
In our case we are keeping all the default settings.

Finally Click on OK.

Now we can able to see the custom property in the Custom Properties Section.


Tuesday, 24 February 2015

Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. ( HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized.

We crawled people to get results while search, so we created a new content source and given the url
Sps3://dotnetsharepoint.com and started full crawling after 2 mins crawl completed and we can able to see the 1 error message at top level

Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. ( HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized.; SearchID


Resolution:
We have to give the permissions for the user profile as shown in the below screen shot.
First we have to identify for which service account having permissions to retrieve people data.
Navigate to your search service application click on it there we can able to see the “Default content access account” with a service account, that account we have to give for our user profile service application
Navigate to the user profile Select the user profile in the top ribbon click on the administrator there we able to see the screen below.
Add the user and check the “Retrieve People Data for Search Crawlers” as shown below.
  
                        


Now crawl the people search again we can able to crawl without any issues.
   

Wednesday, 28 January 2015

The URL must be in one of the following zones: Local, Intranet


We configured the Performance Point Service and Secure Store Service for SharePoint Dashboard Designer.
How to configure Performance Point Service in SharePoint?

After completing all the configuration we tried to open the dashboard designer.
It was opened, but we are unable to see the SharePoint Option in that Designer.
Click on the Left hand side top “File Button”-> Designer Options.
In the Server tab give the SharePoint URL, click on connect.
 We are getting the warning message “The URL must be in one of the following zones: Local, Intranet”
                            

In my case we resolved the issue by adding the Site URL for Trusted Sites in the Internet Explorer,as shown below.



Please let us know, still you are facing any issues on this.

Here we find article How to Create a Dashboard Using BI in SharePoint?

Sunday, 25 January 2015

Hide search box in SharePoint


Sometimes we can get requirement to hide the search box in all the pages or only in a particular page.

Using css we can do it easily.

First identify the search box having the id or class in the browser.
In our case having the search box having id

#SearchBox

Option 1:

To hide the search box with in a page using the content editor.
Place the content editor in that particular page you want to hide the search box.
Edit the web part and click on the source editor button
Place the code 
<style type=”text/css”>
#SearchBox
{
display:none !important;
}
</style>

Click ok.
Now verify it we can’t able to see the we search box in that particular page.

Option 2:

In the same way upload particular css file in a library.
Add the content editor in that particular page, edit the content editor refer the css URL.

Click ok.

Now verify it we can’t able to see the web search box in that particular page.


In the same way if you want hide in the entire site collection level for all the pages.

Upload the particular css in a library.
Refer the css in the Site Settings->Look and Feel->Click on the Master Page.
In the Alternate css URL
Select the Specify a css file to be used by this site and all sites that inherit from it:
Browse and select the css URL.
Click ok.
Now verify we cannot able to see the search box in all the pages.


Sunday, 4 January 2015

How to create Content Type for a document library in SharePoint 2013

 To create a content type for a document library user must have permissions with Full Control.
Now we will create the content type as Excel step by step.


Step: 1
Navigate to the Site Settings->Web Designer galleries->click on Site Content Types->Click on Create
Enter the Name as per our requirement
In our case I am entering the name as DotnetSharePointExcel
Select parent content type from:
Document Content Types
Parent Content Type
Document
Put this site content type into:
Custom Content Types for Existing Group
Click ok.  


Step 2:

Navigate to library ->Top Ribbon click on Library Settings->Advanced Settings->Allow management of content types to Yes ->Click ok.
Step: 3

 Navigate to library ->Top Ribbon click on Library Settings->In the Content Types-> Click on Add from existing content types->In Available content types we can able to see the newly created content type Select click on add, Once content type added  Click on ok.
Step: 4

Navigate to Library ->Top Ribbon Click on “Open with Explorer” ->Forms there we have to place the template like EXCEL


Step: 5

Navigate to the library settings->now we can able to see that content type.
Step: 6

Click on Content Type->in Advanced Settings->Enter the URL of an existing document template
Example: http://dotnetsharepoint.com /sites/sharepoint /Document Library/Forms/template.xltx
Click ok. 


Step: 7

 Finally Click on library ->in the top ribbon click on Files->Click on New Document ->there we can able to see the newly created document content type.