Tuesday, 11 November 2014

SharePoint Client Object Model Javascript : JSOM to retrieve an item based on its ID

var item;
Function getItemById(itemId)
{
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var list = web.get_lists().getByTitle('mycustomList');
This.item = list.getItemById(itemId);
clientContext.load(item);
clientContext.executeQueryASync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFailure);
}
Function onSuccess()
{
Alert('Success');
}
Function onFailure()
{
Alert('Failure!');
}

Can i make my web front end server as a Crawl server in Sharepoint

Can i make my web front end server as Crawl server.
Ans) It's not suggestable.
Reason:
The reason for a crawl target is to limit the user impact of the Search Crawl on your Production farm. Crawling will hammer your Front End servers due to massive amount of requests for content. If you set up a crawl target (dedicate a box directly for search crawls) then users will be not impacted by your heavy performance crawl in-progress
How to stop Crawl in WFE.
Disable HTTP throttling on the crawl target so no crawl requests will be queued or delayed on the Front End machine. Open up a SharePoint Management Console (PowerShell) and run this script
$svc=[Microsoft.SharePoint.Administration.SPWebServiceInstance]::LocalContent
$svc.DisableLocalHttpThrottling
$svc.DisableLocalHttpThrottling=$true
$svc.Update()
How to setup a dedicated Crawl Server.
To set the farm to distribute crawl traffic to only the Front End that is specified as your crawl target, in this example : Server1 is my crawl target and http://sharepoint is my farm name. Run this in the same or seperate instance of PowerShell.
$env:farmurl = "http://sharepoint"
$env:crawltarget = "server1"
$listOfUri = new-object System.Collections.Generic.List[System.Uri](1)
$zoneUrl = [Microsoft.SharePoint.Administration.SPUrlZone]'Default'
$webappUrl = $env:farmurl
$webapp = Get-SPWebApplication -Identity $webappUrl
$webApp.SiteDataServers.Remove($zoneUrl)
$listOfUri.Add("http://$env:crawltarget");
$webApp.SiteDataServers.Add($zoneUrl, $listOfUri);
$WebApp.Update()
You have successfully setup your crawl target, now your Search crawls can perform with high performance without impacting users on your farm.

SharePoint Add Query Rules for promoted results

Create a result source. Ex: MySearchResult
Add Query Rules for promoted results
Open SPO site. The site where your search page is configured.
Click on Site Settings
Click on Query Rules

Click on “Select Result Source…”

Select: MySearchResult
Click on “New Query Rule “


In the new window, Enter Rule name.
Click on “Add Promoted Result”

You will see new window. Add some data.

Repeat Click on “Add Promoted Result” and add some data.

After adding promoted results, page will looks like this.


Why we need to create Named Query in SSAS instead of using Normal View


In Actual Development, You will not have any permission in Database (Client Database), so you can not create View in Database.
So we can do only using Named query from Data Source Views and named query will not be available in Actual Database. It will be available in Data Source Views level

How to restart IIS


Click Start.
Click Run
Type IISReset
ok
Or
Open IIS.
How to open IIS
Click Start.
Click Run
Type inetmgr
In IIS Manager, right click the local computer, point to All Tasks, then click Restart IIS.
Or
1. From the Start menu, click Run.
2. In the Open box, type cmd, and click OK.
3. At the command prompt, type iisreset /stop. IIS will attempt to stop all services and will return confirmation once all services have been stopped.
4. At the command prompt, type iisreset /start.

How to hide Web Part Headers in SharePoint

1. Add a content editor web part to your page.
2. Edit the Web Part
3. Click in the content area of the web part, click HTML and select “Edit HTML Source”
4. Put the following code in the web part:
Add below code in the style tag
TR.ms-viewheadertr > TH.ms-vh2 {
DISPLAY: none
}

5. Click “OK”
6. Expand “Appearance” (on the right side of the page)
7. Set the chrome type to “None”
8. Click “OK” and then save and check in your page.
The headers of your web part should now be hidden. This can be extremely helpful when your page contains a web part using “boxed” for your style when creating a list view. The only downside to this approach is if you have multiple web parts on a single page, it will hide the headers for all the web parts on your site.
Hide Web Part Headers with SharePointHide Web Part Headers with SharePointHide Web Part Headers with SharePointHide Web Part Headers with SharePointHide Web Part Headers with SharePointHide Web Part Headers with SharePoint

Monday, 10 November 2014

What is Site and Site Collection in SharePoint

What is Site
Site is a collection of web pages which is used to store information in organized way.
Site stores list of documents, discussion, events, task and many other types of information.
Site provides controlled access to share information among user. i.e. Only Authorize users are allowed to access shared information.
What is Site Collection
Site Collection is collection of SharePoint site. i.e. SharePoint site collection is logical grouping of multiple SharePoint site.