Showing posts with label Sharepoint. Show all posts
Showing posts with label Sharepoint. Show all posts

Sunday, 24 February 2013

The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator.


You may receive this error when trying to publish a infopath form in SharePoint 2010.

The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator.

Cause :
State service is not enabled on Server.You would need to install the ‘State Service’ via the Configuration wizard in Central Administration or via PowerShell.

Before configure the settings check by using following steps.
1. Go to "Application Management" --> "Manage service applications"
2. Check whether the "State Service" is enabled or not
3. If the service is not started or missed, we should configure/start the state service. OK.

Configure the State Service using the Farm Configuration Wizard
1- Open Central Administration. Click on Configuration Wizards option from left navigation.

2 - Click on the "Launch the Farm Configuration Wizard" option from RHS.

3 -  Click on the "Start the Wizard" button.

4 - On the services configuration page, in the Services section, select the State Service check box (and/or any other services you might be interested) and click Next.

5 - If you set-up a top-level site already click on Skip button if not go ahead and create it now by clicking OK.

6 - On the final page of the Farm Configuration Wizard, review your freshly installed services and click Finish.

Configure the State Service using Windows PowerShell
1 - Open SharePoint 2010 Management Shell.
2 - To create a service application, type the following command:
      $serviceApp = New-SPStateServiceApplication -Name "State Service"
3 - Create a State Service database and associate it with a service application, by typing:
      New-SPStateServiceDatabase -Name "StateServiceDatabase" -ServiceApplication $serviceApp
4 - Create a State Service Application Proxy and associate it with the service application by typing:
      New-SPStateServiceApplicationProxy -Name "State Service" -ServiceApplication $serviceApp -   DefaultProxyGroup

Friday, 15 February 2013

List Join in SharePoint 2010 using CAML

1. Create a list Department and enter some values in it.
 
2. Create a list "Employee". Here create a column department and make it as look up column of Department -> Title. Enter some values in it.
 
3. Create a web part using visual studio and deploy.
   a) Drag and drop a grid view from tool box in the designing part.
   b) Write the below code to join the list.

       Code:
       using (SPSite site = new SPSite("http://win-j9h3l62i2n9:1000/"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList list = web.Lists["Employee"];

                        SPQuery query = new SPQuery();
                        query.Query = @"<Query><Where><Eq><FieldRef Name='Gender' /><Value Type='Choice'>Male</Value></Eq></Where></Query>";

                        query.Joins = @"<Join Type='INNER' ListAlias='Department'>
                                            <Eq>
                                               <FieldRef Name='Department' RefType='ID' />
                                               <FieldRef List='Department' Name='ID' />
                                            </Eq>
                                        </Join>";

                        query.ProjectedFields =
                             @"<Field Name='Dep_Code' Type='Lookup' List='Department' ShowField='Title' />
                               <Field Name='Dep_Name' Type='Lookup' List='Department' ShowField='Name' />
                               <Field Name='Dep_Comment' Type='Lookup' List='Department' ShowField='Comment' />";

                        query.ViewFields = @"<FieldRef Name='Gender' />
                                             <FieldRef Name='Dep_Code' />
                                             <FieldRef Name='Dep_Name' />
                                             <FieldRef Name='Dep_Comment' />";

                        query.RowLimit = 100;

                        SPListItemCollection items = list.GetItems(query);

                        DataTable dt = items.GetDataTable();

                        grdShow.DataSource = dt;
                        grdShow.DataBind();
                    }
                }
 
4. Build and deploy.

Wednesday, 30 January 2013

How to use Iframes in Sharepoint

1 - Add a content editor web part on to the page. To add a content editor web part
     Click on Web part -> Media and Content -> Content Editor -> OK.

2 - Click on Format Text -> HTML -> Edit Source tab in Ribbon.

3 - Add the following in the Source.
     <iframe width="420" height="315" src="http://sanjeetsatapathy.blogspot.com" frameborder="0"  allowfullscreen></iframe>
    Click ok.

4 - Click on Save to save your work. You will get your desired result.


Monday, 28 January 2013

Enable Sync to SharePoint Workspace for SharePoint document libraries

We will be see how to enable Sync to SharePoint Workspace button in the ribbon interface for SharePoint document libraries so that the documents can be synced to SharePoint Workspace and the users can work from offline.

To enable Sync : 
1. Go to Shared Documents -> Library Settings -> General Settings -> Advanced Settings.

2. Click Yes in Office Client Availability section -> OK.

3. Sync to SharePoint Workspace option is enabled successfully.

Tuesday, 15 January 2013

The current page has been customized from its template. Revert to template.


If you have customized a SharePoint 2010 aspx page by using SharePoint Designer, you may experience that when opening the modified webpage in your browser, that a yellow bar below the navigation bar will appear. This is not actually a error. This is a warning message.

To resolve this, you can use one of the below steps.

First Way :
Add the Css in the master page.
<style type="text/css">
body #pageStatusBar{height:0px; font-size:0px; padding:0px; border-style:none;}
</style>

2nd Way :
The following style attribute to the first DIV:
<div id="s4-statusbarcontainer" style="display: none">
<div id="pageStatusBar">
</div>
</div>

3rd Way :
Add the below code in the head section.

<head>
<title></title>
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(hideWarning, "SP.js");

function hideWarning() {
    var statusbarContainer = document.getElementById('s4-statusbarcontainer');    
    if (statusbarContainer != null) {  
       var messageSpan = document.getElementById('pageStatusBar');    
       if (messageSpan != null) {
           if (messageSpan.innerHTML.indexOf('The current page has been customized from its template.') == -1)
               statusbarContainer.style.display = 'inline';      
       else
       statusbarContainer.style.display = 'none';
}
    }
}
</script>

</script>
</head>

Wednesday, 9 January 2013

The Site URL property of the project does not contain a valid URL

The Site URL property to which this error is referring can be found in the properties tool window when you have the project selected.  If you cannot see the properties tool window then you should be able to make it appear by hitting F4 or selected View > Properties Window from the menu.  From there, you just type the URL into the Site URL property and you should be good to go.

You must specify a value for this required field


If you are using a custom masterpage it is very common to use the visible="false" tag to hide element SharePoint is looking for but you don’t want displayed on your page.  If you did this with the PlaceHolderPageTitleInTitleArea tag at first glance everything works as it should.  However, you will notice that you can no longer save pages through the UI without getting the “You must specify a value for this required field” error.

To resolve this issue. Create a css class and call it.

.hide {
visibility: hidden;
}

Then wrap your PlaceHolderPageTitleInTitleArea in a <asp:Panel> tag that looks like this…

<asp:panel runat="server" cssclass="hide">
  <asp:contentplaceholder id="PlaceHolderPageTitleInTitleArea" runat="server" />
</asp:panel>

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.

Friday, 30 November 2012

How to connect FBA site


ClientContext clientContext = new ClientContext("http://YourUrlHere");
clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
clientContext.FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo("username", "password");

Monday, 26 November 2012

Changing URL of Sharepoint 2010 List

1 - Open Sharepoint 2010 site in Sharepoint Designer 2010.
2 - Click on All Files view.
3 - From the report click on Lists and from the left pane expand lists and then select the list for which the URL has to be changed.
4 - Then right click on the list name and from the context menu click Rename.
5 -If the name is changed here then the URL of the list is also changed to reflect the name change.

Sunday, 25 November 2012

How to deploy .wsp file using Visual Studio 2010 for SharePoint 2010


To deploy any solution package in any local environment in Visual Studio 2010 simply right click on the project and deploy. But to deploy the same thing in the production server we will need to deploy through .wsp file.

Right click on the project/solution in Visual Studio 2010 then choose package. If you are building the project/solution in debug mode then you will get the .wsp file inside the Bin\Debug folder and if you are building the project in release mode then you will get the .wsp file inside the Bin\Release folder. This wsp file is needed to deploy in the production environment.

Using browser:

Go to the Central Administration -> Site Actions ->Site Settings -> Galleries –> click on Solutions.
Click on Upload solution and then browse to the wsp file from the ribbon.
Once you will click Ok then activation window will appear. Click on Activate.
Then you can use the solution.

Using PowerShell:

To add a solution using PowerShell:
Open the SharePoint 2010 Management Shell. You can get to this by going to Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell.
Add-SPSolution {path of wsp file}

To deploy the solution using power shell
Install-SPSolution –Identity {path of wsp file}.wsp –WebApplication http:// -GACDeployment

To update solution
Update-SPSolution –Identity {path of wsp file}.wsp –LiteralPath {local path of wsp file}wsp –GACDeployment

To uninstall solution
Uninstall-SPSolution –Identity {path of wsp file}.wsp –WebApplication http://

Remove solution
Remove-SPSolution –Identity {path of wsp file}.wsp

Using Stsadm:

Add the solution
stsadm -o addsolution -filename {path of wsp file}

Deploy the solution
stsadm -o deploysolution -name {path of wsp file} -url {URL}

Retract solution:
stsadm.exe -o retractsolution -name {path of wsp file}.wsp –URL

Delete Solution
stsadm.exe -o deletesolution -name {path of wsp file}.wsp

Saturday, 17 November 2012

How to backup individual page in sharepoint



1. Open the site in sharepoint designer and select(or (highlight) the page you want to backup.
2. Goto File -> Save As and save it to your local desktop.
       or
   Click on the "Export File" option from the ribbon and save it to your local desktop.
3- Copy the file which you saved in the desktop.
4- Go to your production, open your site collection in the sharepoint designer.
5- Go to site pages -> Paste the file which you copied.
   Sharepoint designer automatically saved the page in the database.
6- Open the page using browser by navigating your site.