Friday 15 February 2013

Add,Update,Delete Sharepoint 2010 list item

We can easily add,update,delete sharepoint list item .The below code will show how to do these three operation on sharepoint list, using Sharepoint Server Object Model .  

        try
            {
                //Get the current web object
                SPWeb _web = SPContext.Current.Web;

                _web.AllowUnsafeUpdates = true;

                //Get the List Object
                SPList _mylist = _web.Lists["MyList"];

                //Add a new item into list
                SPListItem addItem = _mylist.Items.Add();
                addItem["Title"] = "Adding New Item";
                addItem["Name"] = "Sandeep";
                addItem.Update();
               
              
                //Get list Item ID
                int itemId = addItem.ID;
               
                //Update list item using Item ID
                SPListItem updateItem = _mylist.GetItemById(itemId);
                updateItem["Name"] = "Sandeep Nandey";
                updateItem.Update();

                //Delete List Item using ID
                SPListItem deleteItem = _mylist.GetItemById(itemId);
                deleteItem.Delete();

                _web.AllowUnsafeUpdates = false;

            }
            catch (Exception Ex)
            {
                lblMessage.Text = Ex.Message;
                   
            }
           

Sunday 10 February 2013

Steps to deploy solution (WSP) to sharepoint server 2010 and enabling feature

Steps :

1. Start the  "Sharepoint 2010  Administration Service" from services to perform deployment

2. Add  solution file (WSP) using sharepoint powershell using below command :

  Command :   Add-SPSolution " D:\MySharepointSolutions\ProSalesEvents.wsp"

Soution will be added successfully .


3. Now to deploy solution, go to :

 Central Administration > System Settings > Manage Farm Solution 


 4. Find your added solution name and click on name.

5. Click  "Deploy Solution"  

6.Click Ok solution will be deployed globally .

7.After deploying solution successfully  we have to activate the feature of the deployed solution to makes it working :

a. Navigate to the site where you want to activate the feature .
b. Go to "Site Settings "
c .Click "Manage Site features"
d. Find the feature of depolyed solution and activate it .






Thursday 7 February 2013

Retracting and Removing Solution from Sharepoint 2010 Central Adminsiatration


Steps to remove Solution from central Administration :

1.Open Central Administration and go to : System Setting > “ manage farm solution “ :



2.Find the solution name to be removed and click on the name :


3. Click on Retract solution :














4: below screen will come ,click OK


5. you will see below screen click on the name 




6.Click  on Remove solution and OK .







Solution will be removed !




Tuesday 5 February 2013

Step by Step Configuring Sharepoint 2010 RSS Viewer Web Part

Steps :


Initial Configuration :

1. Navigate to the virtual directory of the SharePoint site, like: C:\inetpub\wwwroot\wss\VirtualDirectories\yoursitename

2. In the root you will find the file web.config. Edit this file and search for the line with<system.net>. Now copy and paste the following lines and make sure you change the valueproxyaddress to the address of your own proxy server:

 
<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true"> 
        <proxy bypassonlocal="true" proxyaddress=http://172.32.99.132:8080 /> 
    </defaultProxy> 
</system.net>
 
 
3. Save the file and restart IIS. To reset IIS, click Start > All Programs > Accessories > right-clickCommand Prompt, select Run as administrator, type in iisreset, and press ENTER.
 
 


Configure RSS viewer Web Part:

  1. Go to the SharePoint site and click , Site Actions => Edit page.

   2.In the ribbon interface go to Editing Tools => Insert => Web Part.


3.In the Categories select "Content Rollup" => RSS Viewer => Click on Add.


                                  


4.  In the Web Part properties enter the URL for the "RSS Feed URL" and click OK.


5. You may be getting an error as below.


     


6. In many blogs they said that the feed we are trying to get requires authentication and this issue occurs if you use NTLM authentication for the RSS feed instead of one of the following authentication methods: 
    • Kerberos authentication
    • Anonymous Acess

<!--[if !supportLineBreakNewLine]--> <!--[endif]-->
7.Go to Central Administration => Application Management => Manage Web Applications

8.Select the web application where the RSS viewer Web Part is created.

9.In the ribbon interface, click on Authentication Providers.


<!--[endif]-->
            

10 .Click Default
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->




11.In the IIS Authentication Settings, select "Negotiate (Kerberos)".


12: Click Ok and now check your Rss viwer webpart .





Enjoy !! 

<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->