Saturday, November 12, 2011

CSS for welcome user control in sharepoint2010

.ms-SPLink A:link,.ms-SPLink A:visited
{
color:blue;
text-decoration:none;
font-size:12px;
font-weight:bold;
text-decoration:underline;
}

CSS for Fixed width master page in sharepoint2010

Custom CSS file for fixed width master page:

#s4-bodyContainer
{
width: 1000px !important;
margin-left:auto;
margin-right:auto;
}
.ms-cui-ribbonTopBars
{
width: 1000px !important;
margin-left:auto;
margin-right:auto;
}
.ms-cui-topBar2
{
border-bottom:solid 1px transparent !important;
}
#s4-mainarea
{
background-color:#ffffff;
}
body.v4master
{
overflow: visible;
background-image:url('../SiteAssets/background.jpg');
}
body #s4-ribbonrow
{
background-color:#865102;
}
/* If you want to change the left navigation width, change this and the margin-left in .s4-ca */
body #s4-leftpanel
{
padding-right:20px;
}
/* body area */
.s4-ca
{
margin-left:auto;
}
.ms-cui-ribbonTopBars
{
width: 1000px !important;
margin-left:auto;
margin-right:auto;
}
.ms-cui-ribbonTopBars > div
{
border-bottom:1px solid transparent !important;
}

Moss How to remove My settings in Welcome Menu

Sometime you may want to hide the MySettings menu item from the Welcome control of SharePoint
You can follow the steps below:

1. Take a copy of Welcome.ascx file (under 12 hive\Template\ControlTemplates folder)
2. Rename it as CustWelcome.ascx
3. Find the tag with Personalization For Eg:

Text=”<%$Resources:wss,personalactions_personalinformation%>”
Description=”<%$Resources:wss,personalactions_personalinformationdescription%>”
MenuGroupId=”100″
Sequence=”100″
ImageUrl=”/_layouts/images/menuprofile.gif”
UseShortId=”true”
Visible=”true”
/>
Change the Visible to false (if visible is missing add it and set it as false)

Text=”<%$Resources:wss,personalactions_personalinformation%>”
Description=”<%$Resources:wss,personalactions_personalinformationdescription%>”
MenuGroupId=”100″
Sequence=”100″
ImageUrl=”/_layouts/images/menuprofile.gif”
UseShortId=”true”
Visible=”false”
/>

Now go to the master page and change the reference from welcome.ascx file to CustWelcome.ascx

Friday, November 11, 2011

AddandUpdate data into list, listItem wise in sharepoint2010

Uploading image into list using share point object model

Java script code for hiding the rows in the table

CAMl Query samples

Get attachment from list in sharepoint2010

Get List data from List to DataTable in .Net

Send Mail using .Net Code


MailMessage objMail =new MailMessage();

objMail.To.Add("venkat@gmail.com");

objMail.Form=New MailAddress("sri@gmail.com");

objMail.Suject="Welcome";

objMail .IsBodyHtml=true;

objMail.Body=<table> <tr> <td> Name: </td> <td> Venkat: </td></tr></table>

SmptClient  objsmpt =new SmptClient  ("smpt.test.com");

Objsmpt.Send(objMail);

batch code for list in sharepoint

Code for add &update ListItem in sharepoint2010

Code for Adding ListItem:

try
{
SPWeb certusweb = SPContext.Current.Web;
SPList lstName = certusweb.Lists["ListName"];
SPListItem lstItem = lstName.Items.Add();
lstItem["Title"] = "Score";
lstItem["Minimum"] = txtMinimumT1.Text;
lstItem["Maximum"] = txtMaximumT1.Text;
certusweb.AllowUnsafeUpdates = true;
TierItem1.Update();
certusweb.AllowUnsafeUpdates = false;
}
catch(Exception ex)
{

Response.Writte(ex.ToString());
}


Code for Updating ListItem:


try
{
SPUser user = web.CurrentUser;
StudentId = user.Name;
SPWeb web=SPContext.Current.web;
SPlist lstName = web.Lists["ListName"];
SPQuery qry = new SPQuery();
qry.Query ="// Here you can write sample query for getting items from list " + StudentId + "";
SPListItemCollection coll = lstName.GetItems(qry);
if (coll.Count > 0)
{
foreach (SPListItem items in coll)
{
if (!string.IsNullOrEmpty(txtFname.Text))
items["FirstName"] = txtFname.Text;
if (!string.IsNullOrEmpty(txtLname.Text))
items["LastName"] = txtLname.Text;
if (rdbMale.Checked)
items["Sex"] = "Male";
else if (rdbFemale.Checked)
items["Sex"] = "Female";
if (!string.IsNullOrEmpty(txtState.Text))
items["State"] = txtState.Text;
web.AllowUnsafeUpdates = true;
items.Update();
web.AllowUnsafeUpdates = false;
}
}
}
catch(Exception ex)
{

Response.Writte(ex.ToString());
}

Tuesday, November 1, 2011

SharePoint 2010 Event Receiver: -Attach event receiver to specific lists.









Note:follow


https://tolgaizgi.wordpress.com/2011/05/25/sharepoint-2010-event-recevier-attach-an-event-recevier-to-a-custom-list/

http://msdn.microsoft.com/en-us/library/ff398052.aspx

http://msdn.microsoft.com/en-us/library/gg241249.

Friday, October 21, 2011

Hosting the asp.net web application on Webserver

Note:Following link http://www.dotnetfunda.com/articles/article1247-how-to-host-aspnet-application-on-the-web-server-iis.aspx

Saturday, October 15, 2011

How To Hide Ribbon From Users Without Edit Page Privilege














follow this link

http://blogs.msdn.com/b/zwsong/archive/2010/04/29/how-to-hide-ribbon-from-users-without-edit-page-privilege.aspx

Thursday, September 29, 2011

Server Error in ‘/’ Application. Runtime Error in Sharepoint2010

when ever you are get this error message you need do following 3 changes in your web.config file
1.In customErrors tag set mode="Off" to "On"
2.In SafeMode tag set CallStack="true" to "false"
3.In compilation tag debug="false" to "true"

after do these changes in web.config you get require error message in sharepoint
Ex: When i trying to create custom list columns more than 276. i got following error message
size of the columns in this list exceeds the limit. Please delete some other columns first.

Friday, September 23, 2011

Form based authentication(FBA) in sharepoint 2010

Form based Authentication:
Step1: create web application
Enable Form based authentication…
give names for Membership provider and Role Provider at this point.
Take default or custom sign in page as you wish.
Step2: now we have to create Connection string, membership provider and role provider for all three web.config file… 1.our application’s
2. Secure Token Service’s and
3. Central administrator’s.
Step3: go to c:\windows\Microsoft.NET\Framework\V2.0.5…
Double click on aspnet_regsql..
Configure Sql Server…
Give your Sql server name and database name…
Step4: Go to Administrative Tools  Internet Information Service manager
Sites  our application
On the features pane double click on Connection Strings…
1.Give your own connection string name
2.Server Name
3.Data base name
Step5 : back to Features pane Double click on Providers…
Role Provider
1. Select Roles in dropdown…
2. Click on ADD on left side Pane
3. Select SqlRoleProvider on Dropdown List
4. Give Name of Role Provider (ex:CertusRole)
5. Select your connection sting from Dropdown
6. In Application name Text box give as “/”
7. Click save
Membership Provider

1. Select Users in dropdown…
2. Click on ADD on left side Pane
3. Select SqlMembershipProvider on Dropdown List
4. Give Name of Role Provider (ex:CertusMember)
5. Make true for all options of membership provider
6. Select your connection sting from Dropdown
7. In Application name Text box give as “/”
8. Click save
Step6 : Repeat steps 4 and 5 for creating Connetion String, Role Provider and Membership Provider for Central administrator and Secure Token Service…
Step7: come back to our site in ISS manager ….
Select our web application..
Now we have to create roles and Users
I) select .Net Roles -- >click on default provider select your Role Provider Name (ex FBARole)
-- > Click on Add users like (admin, standard).
II) select .Net Users --- >click on default provider select your Member ship provider
( FBAMember)
--- > Click on Add select admin give full details.
Step8: Now you have make the change default Role provider and Membership Providers
1. Go to .Net Role in Features Pane
2. Set Default Role Provider as “i”
3. Go to .Net Users in Features pane
4. Set Default Membership provider as “c”.

Now are almost succeeded in provide Form based Authentication to your web application , but you may get these exception
“You must Specify non auto generated machine key…..”
Resolution: After Completed the creation of Connection string , Role Provider and Membership Provider You should mention tag in each of 3 Web application’s web.config files in three places
1. In ConnectionStrin
2. In providers under membershipProvider
3. In provider under roleProvider
“Acess Denied”
You should give Permission for NTAuthority/Network Service in Sql Server..
-- Create a SQL Server login for the Network Service account
sp_grantlogin 'NT AUTHORITY\Network Service'

-- Grant the login access to the membership database
USE DataBaseName
GO
sp_grantdbaccess 'NT AUTHORITY\Network Service', 'Network Service'

-- Add user to database role
USE DataBaseName
GO
sp_addrolemember 'aspnet_Membership_FullAccess', 'Network Service'


Then go to Central administration Manage web applications
select your web application
select Authentication Providers
 Give your Membership provider name and role Provider name
Now select User Policy add your Membership Users and Give permissions…
Then it will work properly…

Tuesday, June 7, 2011

Interview Quations

Interview Quations With Spade Wrox

1)I a Have Some Lists With Permissions and One List which DoestNot Have permission I want to display that list Name In sharePoint Webpart How This is Possible Tell Me?


Ans:This is possible With RunWithEvillatedPrevilinges


2)Tell Me Approvel WorkFlow Senarrio

3)How you are implemented Custom Content Type In your Project ?

Interview Quations

Interview Quations With Spade Wrox

1)I a Have Some Lists With Permissions and One List which DoestNot Have permission I want to display that list Name In sharePoint Webpart How This is Possible Tell Me?


Ans:This is possible With RunWithEvillatedPrevilinges


2)Tell Me Approvel WorkFlow Senarrio

3)How you are implemented Custom Content Type In your Project ?

Interview Quations

Interview Quations With Spade Wrox

1)I a Have Some Lists With Permissions and One List which DoestNot Have permission I want to display that list Name In sharePoint Webpart How This is Possible Tell Me?


Ans:This is possible With RunWithEvillatedPrevilinges


2)Tell Me Approvel WorkFlow Senarrio

3)How you are implemented Custom Content Type In your Project ?

Sunday, June 5, 2011

How to Hide Particular column in customlist OR Title Column

http://www.endusersharepoint.com/2010/01/05/how-to-remove-the-%E2%80%9Ctitle%E2%80%9D-column-from-a-sharepoint-list/


Or
Procedure


Create One CustomList

Name :Employee


Bydefault Title column is Coming You want to Hide That column


Procedure:

Settings.....>ListSettings........>Advanced Settings.....>Select Allowmanagement Content Type ....>Ok

Item .....>DoubleClick on Item u can observe Title column .....>U find one Radio button option like Hide u can check click on ok

Now Click on Add
You cann't find Title Column.

Saturday, June 4, 2011

How to Deploye wsp file(visual webpart) using power shell

Visual Studio 2010 makes it really easy to add and deploy solutions when you are developing, but you may eventually want to deploy those solution packages elsewhere right? We can still use stsadm, but that is effectively considered deprecated now in favor of PowerShell. In the past to add a solution, we used an stsadm command like the one below. In today’s example, we’ll be working with a package called SharePointProject2.wsp on my server named sp2010.

stsadm –o addsolution –name SharePointProject2.wsp

To get started with PowerShell, run the SharePoint 2010 Management Console located in your Microsoft SharePoint 2010 Products folder on your start menu. This automatically loads the Microsoft.SharePoint.PowerShell snappin so that we can execute SharePoint commands. To install a solution we use the Add-SPSolution command. If you are using a Sandboxed solution you would use Add-SPUserSolution instead. It takes just one parameter, –literalpath, which is the path to the solution file. One thing that is different is that you must specify the full path to the file for some reason. I haven’t been able to get it to take a path to the solution in the current folder even if I make use of .\ before the filename. Here is an example.

Add-SPSolution c:\code\SharePointProject2\bin\debug\SharePointProject2.wsp

In this case you don’t actually have to type –literalpath before the parameter. This is what it looks like when executed. You can see that it displays the id of the solution along with its deployment status.



Now we need to deploy the solution. In the past, we used an stsadm command like the following.

stsadm –o deploysolution –name SharePointProject2.wsp –url http://moss-server –allowCasPolicies –immediate

We would also follow this up with a call to stsadm with the execadmsvcjobs operation. To do the same operation in PowerShell, we use the Install-SPSolution command (again use Install-SPUserSolution for Sandboxed solutions). You can use the Get-Help command (i.e.: Get-Help Install-SPSolution) to get more information on a command but it’s not always obvious what it is expecting as you can see below. That is why I am writing the post today.



The first parameter you need is the –Identity parameter. This is the name of the solution package (i.e.: MySolution.wsp). Depending on if you are using the GAC or Code Access Security, you will specify either –GACDeployment or –CASPolicies. You then need to specify a specific web application using the –WebApplication parameter or –AllWebApplications to deploy it to all web applications (assuming the manifest allows it). If you need to force the deployment, you can still use the –Force command. Here is what an install command might look like.

Install-SPSolution –Identity SharePointProject2.wsp –WebApplication http://sp2010 -GACDeployment

CIO, CTO & Developer Resources
I’ll point out that executing this command actually does do the deployment operation. You don’t have to fire off something to execute a job later like you did with stsadm.

You might want to update your solution, so we’ll talk about how to do that as well. Here is what your stsadm command might have looked like in WSS3. Which would also be followed up with an execadmsvcjobs operation.

stsadm –o upgradesolution –name SharePointProject2.wsp –filename SharePointProject2.wsp –immediate –allowCasPolicies

The upgrade solution syntax is similar to the others. We just have to specify an identity and a literalpath with the Update-SPSolution command. The identity is the name of the package on the server to upgrade and the literalpath is the full path to the new solution package on the file system. Here is what that might look like.

Update-SPSolution –Identity SharePointProject2.wsp –LiteralPath c:\code\SharePointProject2\bin\debug\SharePointProject2.wsp –GACDeployment

We’ve talked about everything else, so we’ll finish it up by talking about retraction and removal. To retract a solution we use the Uninstall-SPSolution command. By now you are probably noticing a pattern in the way things are named. Install –> Deploys, Uninstall –> Retracts. It also just uses the -Identity parameter and the –WebApplication parameter. You can also use the –AllWebApplications parameter to retract it from all web applications. Many of these commands may prompt you with an “Are you sure?” type prompt. You can skip this prompt by adding a –confirm parameter. Here is what it looks like.

Uninstall-SPSolution –Identity SharePointProject2.wsp –WebApplication http://sp2010

Lastly, to remove the package from the solution store, we use the Remove-SPSolution command. It just takes the name of the package.

Remove-SPSolution –Identity SharePointProject2.wsp

I hope this helps. If you’re like me, it’s one thing to see the docs on something, but I like to see real examples. There aren’t any examples in the Get-Help command yet. This should cover all of the common commands that you probably used to used with stsadm in regards to solution deployment. The nice thing is that you can script these things together very easily and create highly flexible PowerShell scripts. Expect a few more posts soon on the basics of working with PowerShell and SharePoint 2010.


Read the original blog entry...

Thursday, June 2, 2011

location of Stsadm Tool

Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

Master Pages and Application pages Location

Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS.

Default Css file location in Sharepoint

Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\STYLES.

How to perform BackUp and Restore , Import and Export Using Stsadm Tool in SharePoint

change to 12 have

Back Up:

stsadm -O BackUp -Url "Site Url" -FaleName "Physical Location"

ReStore:

stsadm -O Restore -Url "Site Url" -FaleName "Physical Location"

OR


When you back up by using the Stsadm command-line tool, you can back up individual aspects of your SharePoint Products and Technologies deployment. For example, you can back up an individual site collection or you can back up the entire farm.

To export sites from your SharePoint Products and Technologies deployment, you use the following Stsadm command.

Stsadm –o export –url -filename .cmp
To back up a site collection, you must use the following stsadm command.

stsadm –o backup –url -filename

To back up an individual database, Web application, or the entire farm, you can use the following Stsadm command.

stsadm –o backup –directory -backupmethod

Restore:

To import sites to your SharePoint Products and Technologies deployment, you use the following Stsadm command.

Stsadm –o import –url -filename .cmp

To restore a site collection, you must use the following Stsadm command.

stsadm –o restore –url -filename
To restore an entire farm you can use the following Stsadm command.

stsadm –o restore –directory -restoremethod