Posts

Showing posts with the label Server Object Model

Timer Jobs in SharePoint 2010

Image
Timer Jobs in SharePoint 2010 What is a  Timer   Job ? A  Timer   Job  is a periodically executed task inside  SharePoint  Server. It provides us a task execution environment. For example, we can execute tasks like: update list item everyday, send email every hour Default Timer Jobs Inside Sharepoint: There are many  timer   job s inside  SharePoint  which do internal tasks like: Send emails Validate sites Delete unused sites Health analysis Product versioning Diagnostics These tasks will having execution periods like: Minute Hour Day Week Month see this link for more details           Here I will explain how to create a SharePoint timer job using visual studio.Do the following steps. Step 1 :  Open visual studio->New Project->SharePoint-> Empty SharePoint Project->Give Project name(here I gave as TimerJobExample )-> click Next-...

How to call a silverlight xap file from server object model in sharepoint

Image
How to call a silverlight xap file from server object model in sharepoint We can call the silverlight xap file from server object model using sand box solution in sharepoint Step-1     Open visuvalstudio->new->click sharepoint(left side)->empty Sharepoint Poject->(give project name)->Deploy as a sand box solution-finish Step-2         In solution explorer->(Right click your project)->Add->New itme->Visual Web Part(Sandboxed)->(give name,eg-SandBoxExample)->(click add) Step-3     Add the follwing code on your sand box webpart design page(SandBoxExample.ascx) < object id =" speedsilverlight "              data =" data:application/x-silverlight-2, " style =" z-index:0" type="application/x-silverlight-2 " width =" 320 " height =" 270 ">            < param ...

add update and delete list items programmatically in sharepoint (Server Object Model) :

Add update & delete sharepoint list item programmatically using c#  ( Server Object Model) : First insert the following name space                   using Microsoft.SharePoint; For Adding list item:   protected void Page_Load( object sender, EventArgs e)         {           SPSite site = SPContext .Current.Site;           SPWeb web = SPContext .Current.Web;           SPList listobj = web.Lists[ "ListName "];            //add new item             SPListItem litem = listobj.AddItem();             litem[ "ColumnName1" ] = "one" ;    ...

retrieve sharepoint list data c#

Retrieve sharepoint list data using c#(server object model):    First insert the following name space                   using Microsoft.SharePoint;    Use the following code to retrive  list data   protected void Page_Load( object sender, EventArgs e)         {           SPSite site = SPContext .Current.Site;           SPWeb web = SPContext .Current.Web;           SPList listobj = web.Lists[ "ListName "];           SPQuery qry = new SPQuery ();           qry.Query = "<view/> ";           SPListItemCollection _icoll = listobj.GetItems(qry);  ...

how to add Quick Launchbar in sharepoint Programatically

  how to add  Quick Launchbar in sharepoint Programatically: step1:   First you need to add the following name space using Microsoft.SharePoint; using Microsoft.SharePoint.Navigation; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.Publishing; step 2: And next include the following code in your program   protected void Page_Load(object sender, EventArgs e)         {             using ( var site = new SPSite ( SPContext .Current.Site.Url))             {                 var rootPubweb = PublishingWeb .GetPublishingWeb(site.RootWeb);                 var subwebs = rootPubweb.GetPublishingWebs();       ...

how to add Top navigaiton bar link in sharepoint Programatically

how to add  Top Navigation link in sharepoint  Programatically: step 1: First you need to add the following name space using Microsoft.SharePoint; using Microsoft.SharePoint.Navigation; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.Publishing; step 2: And next include the following code in your program   protected void Page_Load(object sender, EventArgs e)         {             using ( var site = new SPSite ( SPContext .Current.Site.Url))             {                 var rootPubweb = PublishingWeb .GetPublishingWeb(site.RootWeb);                 var subwebs = rootPubweb.GetPublishingWebs();        ...

sharepoint get current user login name using c# (Server Object Model) :

sharepoint get current user login name using c# ( Server Object Model) :       You Can get the current logged in user name usin the following code                       string name = SPContext .Current.Web.CurrentUser.LoginName;         (before that you have to use this namespace  using Microsoft.SharePoint;) To get current user in client object model  see this link