Posts

Showing posts from September, 2012

Add update and delete list items programmatically in sharepoint-client object model

Add update and delete list items programmatically in sharepoint-client object model: Insert the following namespace using Microsoft.SharePoint; using Microsoft.SharePoint.Client; Use the following code.    ClientContext ccsite;    List listobj;    ListItemCollection _icoll;     public MainPage()         {            InitializeComponent();             ccsite = new ClientContext(ApplicationContext.Current.Url);            ccsite.Load(ccsite.Web);            listobj = ccsite.Web.Lists.GetByTitle( "ListName" );            ccsite.Load(listobj);                      CamlQuery qry = new CamlQuery ();             qry.ViewXml = "<View/>" ;             _icoll = listobj.GetItems(qry);             ccsite.Load(_icoll);                      ccsite. ExecuteQueryAsync (new ClientRequestSucceededEventHandler (success), null );         }   private void success( object sender, ClientRequestSucceededEventArgs arg)    {          Dispatcher.BeginI

get list items in sharepoint 2010 c# using client object model:

get list items in sharepoint 2010 c# using client object model: Insert the following Namespace: using Microsoft.SharePoint; using Microsoft.SharePoint.Client; Use the following code.         ListItemCollection _icoll;         public MainPage()         {            InitializeComponent();            ClientContext  ccsite = new ClientContext(ApplicationContext.Current.Url);            ccsite.Load(ccsite.Web);            List   listobj = ccsite.Web.Lists.GetByTitle( "ListName" );            ccsite.Load(listobj);                      CamlQuery qry = new CamlQuery ();             qry.ViewXml = "<View/>" ;              _icoll = listobj.GetItems(qry);             ccsite.Load(_icoll);                      ccsite. ExecuteQueryAsync (new ClientRequestSucceededEventHandler (success), null );         }         private void success( object sender, ClientRequestSucceededEventArgs arg)         {             Dispatcher.BeginInvoke(datacon);   

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" ;             litem[ " ColumnName2 " ] =  "two" ;             litem[ " ColumnName3 " ] =  "three" ;             web.AllowUnsafeUpdates = true ;             litem.Update();         } For Updating Listitem:   protected void Page_Load( object sender, EventArgs e)         {           SPSite site = SPContext .Current.Site;           SPWeb web = SPContext .Curren

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);           foreach ( SPListItem item in _icoll)           {               Label1.Text += Convert.ToString(item[ "ColumnName" ]);           }         } If you want to bind it to a GridView then see this  GridView simple example  ,  Clickable/Databound in GridView

Solve - This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator.

Image
Solve - This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator.     You may have this kind of error when you open a list.To solve this problem do the following Setps: 1.Open central administration->Application Management->manage web application 2.Select your web application from the list of web application(after that the ribbons on the top will be enabled) 3.click on General settings.( Note:do not click on the settings icon, it will take you to setting page. click on below the icon,from the dropdown menu select Resource Throttling ) 4.In that On the Resource Throttling page, check the list view lookup. increment the value  5.Click ok. thats it.

How to grant permission to a SharePoint page:

Image
How to grant permission to a group to access specific Page in SharePoint:     It is very simple process. We have to create a  group and add the group to the page thats it.. see the example. step 1:    Site Actions->Site Permissions->Create Group Step 2:     Give group name and give permission level to this group then click ok     Step 3:    New->Add Users->(here add the users that you want to access the page) Step 4:     Then go to your page->click on page->permissions Step 5:     Click on stop inheriting permissions and ok Step 6:    And now remove all the groups displayed in that page Step 7:     After removing all groups now click->Grand Permissions->type the group name that we created->give permissions->click ok Thats it.. now the members of the group only able to view this page..(except site collection administration users of the site).