Friday 28 December 2012

To deploy the Web Part by using Windows PowerShell


1- On the Start menu, click All Programs.

2 - Click Microsoft SharePoint 2010 Products.

3 - Click SharePoint 2010 Management Shell.

4 - At the Windows PowerShell command prompt (PS C:\>), type the following command, and then press ENTER:

      Install-SPWebPartPack -LiteralPath "<PathToCabFile>" -Name "<WebPartName>"

Where:
   <PathToCabFile> is the full path to the CAB file that is being deployed.
   <WebPartName> is the name of the Web Part that is being deployed.

Wednesday 26 December 2012

Adding a Script Reference Dynamically Through Code


protected override void OnPreRender(EventArgs e)
{
     // Register the jQuery script from "_layouts/jQuery/jquery-1.6.js"
     ScriptLink.Register(this.Page, "jQuery/jquery-1.8.3.js", false);
     base.OnPreRender(e);
}

Friday 21 December 2012

Sharepoint designer workflow does not start automatically

I create a work flow in sharepoint designer and publish it. I enable Automatically start this workflow when a new item is created.But when i create new item this workflow does not start automatic.

Solution:
SPD workflow will not start automatically under System Account.

If you have installed the Infrastructure update, you can change the account that associated the workflow via stsadm which will allow it to automatically start.

Or Log in to a different account and do the same operation in list. Work flow will be running fine.

Thursday 20 December 2012

Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.


I am getting the above error, when I am  trying to deploy the web part through visual studio. The reason is the current logged-in user may not be the "db owner" in the content databases.

Solution:
To deploy the solution successfully, you need to map the current logged-in user as db_owner into the 3 databases.
1. SharePoint_Config
2. SharePoint_Admin_[GUID]
3. Your current web application that needs to deploy the Web part
To do the above open sql server.
Go to security -> Logins. Choose the user name.
Right click on it  -> Go to properties  -> click on User Mapping .

See the below image for details.


Sunday 16 December 2012

How to Remove a User from a SharePoint 2010 Site Collection


1 - As a site collection administrator, click Site Actions –> Site Permissions.
2 - Click into any existing group (like site Owners).  The URL will be something like http://server/_layouts/people.aspx?MembershipGroupID=28.
3 - Change the 28 to a 0.  The list should now show you All People.
4 - Find the user who isn’t updating, click the checkbox by their name.
5 - Click Actions, Delete Users from Site Collection.

What happens behind the scene when we create new Web Application in SharePoint ?


When we create a new Web Application in SharePoint, following are various actions which happens behind the scene:

1 - Creates a unique entry in SharePoint configuration DB for the Web Application and assign GUID to
that entry.
2 - Create and configures a new site in IIS
3 - Creates and configures a new IIS application pool.
4 - Configures authentication protocol and encryption settings.
5 - Assign a Default alternate access mapping for the Web Application.
6 - Creates the first content database for the Web Application.
7 - Associate a search service with the Web application.
8 - Assign a name to the Web application that appears in the Web application list in SharePoint Central Administration.
9 - Assign general settings to the Web application, such as maximum file upload size and default time zone.
10 - Updates the web.config file to make entries for custom HTTP Modules and Handlers for SharePoint.
11 - Creates virtual directories for SharePoint web services and SharePoint layouts folder.

After creating a Web Application in SharePoint, the web site is actually not created yet. It means if you try to access the Web Application using the web app url, it will show you "Page cannot be displayed" error. Basically at this point of time, a web application has been created and all the mandatory configuration has been done. Now the next step is to create a Site Collection using a particular Site Definition, then only the actual site will be created and you will be able to access the site using the url of Site Collection.

Wednesday 12 December 2012

To remove the title column from a Sharepoint list


If you want to remove the "title" column permanently, follow the steps given below:

1. Go to the Settings->List Settings->Advanced settings.

2. Check the "yes" Radio button for "Allow management of Content types" and hit OK.

3. Setp 2 will give you "Content types" option on the settings page which will have "Item" content type.

4. Click on "Item" .

5. Clicking on the "Title" will give the screen where you can hide the column completely for future use. Click on "Hidden" under "Column settings" option in this page and hit Ok.

6. Now go back to the list and add a new item and you won't see the "Title" column.

Filter Lookup Field Values by Current User in caml query


If you want to pass current logged user into caml query, you can use this one :

<Where>
  <Eq>
    <FieldRef Name="Author" />
    <Value Type="Integer">
      <UserID />
    </Value>
  </Eq>
</Where>

Friday 7 December 2012

Completely Remove a Feature from Site Collection

After you deploy a feature from Visual Studio to Sharepoint 2010, you can see the feature in Site Actions  -->  Site Settings --> Site Collection Features, from there you can activate or deactivate the feature.

Click on start --> Microsoft Sharepoint 2010 products --> Sharepoint 2010 Management Shell.

To Complete remove the chnage password option Type
Uninstall-SPFeature ChangePassword

Note: Each feature is available is in its own subdirectory in the path:
%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES\

You need to use the actual subdirectory name (not the name shown in the Site Collection Features screen) in order to uninstall it. You need to deactivate the feature before removing it.