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.