Friday, April 27, 2012

How to search file system other than sharepoint running domain

Scenario: there is one system in one domain sat its in DOMAINONE and sharepoint installed in other domain say it is DOMAINTWO. I want to configure DOMAINONE shared folder in DOMAINTWO but DOMAINONE's system credentials are different with other system i.e DOMAINTWO.

While creating new content source we cann't specify credentials for the DOMAINONE's system. SO what do to do now.

Its very simple...

We can specify credentials for the DOMAINONE's system by using crawl rules

step 1: Go to CA --> Manage Service applications --> Search Service Application

step 2: Click on 'Crawl Roles' Under Crawling on left hand side

Step 3: Click New Crawl Role

a. Path: specify the DOMAINONE shared location. NOTE: add /* after shared path
b. Crawl Configuration: select include all items  in this path
c. Specify Authentication: Select 'Specify a different content access account' and specify DOMAINONE credentials

Now click on 'OK'.

You can test whether the specified location can be crawled or not with the given credential


step 4: Now click Content sources under crawling and click new Content source.

specify the following field values

a. Name: Name of the content source
b. Content source Type: File Share
c. Start Addresses: DomainONe shared folder path
d. Crawl Settings: select 'Crawl the folder and all subfolders of each start address'
e. Crawl Schedules: specify schedules if required
f. Content source priority: Normal
g. start Full Crawl: check start full crawl of this content source

and Click 'OK'.

Step 5: now we need to create scope for the content source,click on scopes under Queries and Results.

step 6: Click New Scope and specify Name of the scope and target result page(select 'use the default search results page'),then click 'OK'.

After creating scope we need to add rules for the scope.Now Click on Add rules for the Scope.

Specify the following field values,

a. Scope Rule Type: select 'Content Source'.
b. Content Source: Choose Content source from the dropdownlist.
c. Behaviour: Select 'Require- Every item in the scope must match this rule'.
And Click on 'OK'.

Step 7. Now to go to your web site , Click on site actions--> site Settings.

Step 8: under site collection Administration click on Search Scopes

Step 9: Click on Display Groups then Click on SearchDropdown and select 'Edit Display Group'.Now Select newly created

Content source and Click on 'OK'.

Sunday, April 15, 2012

Developer Dash Board in SharePoint 2010

One of the great feature in SharePoint for developers is "Developer Dash Board".

What is Developer Dash Board?

In SharePoint, We can do lot of customization and all our code will be deployed to SharePoint and end users will use it.But, if client comes to you with the question, "why my SharePoint site is loading very slow?" how can we proceed?.

First thing you need to check is all server configurations like memory is sufficient ,processor is sufficient etc.. After you found they are more than enough, now its time to find problem in the code. Till SharePoint 2007, it's very difficult to find which part of the code is taking how much time and analyze it better. BUt luckily in SharePoint 2010, Microsoft added a very nice feature for developers to detect which module is taking how much time. It will record all the requests and the time to get response etc... This is what we are calling "Developer Dashboard".

The great advantage with it is, it will differ the requests and show like, database queries(which query took how much time), SPRequest allocation,wepart event offsets, etc in very detailed way. Its very great and useful to the developers.

How to enable and disable it in sharepoint

Method 1: Using STSADM

STSADM -o setproperty -pn developer-dashboard -pv On (which for always showing dashboard at bottom of the page)

STSADM -o setproperty -pn developer-dashboard -pv Off (which for stop showing dashboard)

STSADM -o setproperty -pn developer-dashboard -pv OnDemand (which for showing dashboard when only dashboard image clicked on that particular page)

I Used "OnDemand" command to enable dashboard

Once the command executed the command the outputis "Operation executed successfully."

Method 2: Using PowerShell script

You need to open the windows power shell prompt and copy the below script and hit enter.

$DevDashboardSettings = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$DevDashboardSettings.DisplayLevel = 'OnDemand';
$DevDashboardSettings.RequiredPermissions = 'EmptyMask';
$DevDashboardSettings.TraceEnabled = $true;

The both above methods will enable developer dashboard to entire farm level.

Now, browse to the web site you can't find it immediately on the screen(because i used "ondemand" command). So need to explicitly enable for the page. Find a small icon at the corner of the page as shown below.(i scroll downed and showing u bottom of the page there is no dashboard on the screen).

That icon behave as a toggle button. when you click very first time then the developer dashboard will be enabled for the specific page at bottom of the page. When you click again then it will go off. You cannot see that until you click it again.

Sunday, April 8, 2012

ERROR TYPE: "cannot start service spusercodev4 on computer sharepoint 2010"

When i trying to create a sandboxed solution for SharePoint2010 in Visual Studio 2010 and try to deploy the solution, i got the error "Error occurred in deployment step ‘Retract Solution’: Cannot start service SPUserCodeV4 on computer".

In Order To fix this error, do like this
go to Central Administration -> System Settings -> Manage services on server and start service "Microsoft SharePoint Foundation User Code Service".

Now try to deploy sandbox solution this time i didn't got any error.

Thursday, April 5, 2012

How to change SharePoint 2010 project deployment URL

I am currently developing some custom web parts using visual studio 2010 for my SharePoint 2010 project. I have deployed the web parts by giving by local site url. Then i try to change that URL to another site collection.

Solution for that one is

1.Simple select the project.

2.Now select Properties window near solution explorer.(But Dont right click on project and select properties)
It will open with options like Active Deployment configuration, Assembly deployment Target, Project File, Sandboxed solution, Site URL.

Simply change Site URL with where u want to deploy this webpart.

Error : Type SP.PermissionKind has already been registered.

For the first time using ECMAscript the following error i got it which is
"Error : Type SP.PermissionKind has already been registered."
By seeing the error i thought some thing is registered twice.
Find any script tag which is pointing to /_layouts/SP.js as source.if it is there remove it.
So i simply removed "script" tag which is using "SP.js" as source file.
Now deployed my code this time i didnt get any error.

This SP.js file is already registered in master page.SO no need to use again in ECMAScript.

Error Type: Error occurred in deployment step 'Recycle IIS Application Pool': The vssphost4.exe process was unable to start due to an unknown error

I got the following error while deploying sharepoint 2010 visual wepbart
"Error occurred in deployment step 'Recycle IIS Application Pool': The vssphost4.exe process was unable to start due to an unknown error or problem."

The reason for this error is There is one more visual studio is opened and its debugging location is same as the currently running visual studio debugging location.

Solution is close all opened visual studio and reopen your project and deploy. now you wont get any error.