Powered By Blogger

Wednesday, 30 November 2011

Creating a Custom Field Item

To Create Custom Field Item:

Display the New Project dialog box by pointing to New on the File menu, and then clicking New Project.
Expand the SharePoint node under either Visual C# or Visual Basic, and then click 2010.

Click Empty SharePoint Project in the Templates pane, change the name of the project to CustomField1, and then click OK.

The SharePoint Customization Wizard appears. The Empty Project template is used for custom field items because there is no template for them.
  1. On the Specify the site and security level for debugging page, enter the URL for the SharePoint server site to which you want to add the new custom field item, or use the default location (http://<system name>/).


     In the What is the trust level for this SharePoint solution? section, use the default value Deploy as a sandboxed solution.

    Then Click Finish.


    Add an Empty Element project item to the project. To do this, click the field's project node (CustomField1) in Solution Explorer and then click Add New Item on the Project menu.
     
    1. Expand the SharePoint node under either Visual C# or Visual Basic, and then click 2010.
    2. In the Templates pane, select Empty Element, keep the default name EmptyElement1, and then click Add.
      1. In the Elements.xml file under EmptyElement1, add the following after the <Elements> tag:

         2..This adds a field that is named Patient Name.
    Press F5 to run and deploy the project to SharePoint.If you get a message that script debugging is disabled, click Yes to continue debugging.

    At the top of the SharePoint Web page, click the Site Actions button and then click Site Settings.

    Under the Galleries section of the Site Settings page, click the Site columns link. 
  2.  In the Site Column Gallery page, scroll the page down to the Custom Columns heading and note the new field item added, Patient Name.
  3.  

  4. Close the browser.







Wednesday, 23 November 2011

Creating Event Receiver in Sharepoint 2010

In this blog I am going to demonstrate how to create a simple Item added event receiver for a custom list in SharePoint 2010

1.Start Visual Studio 2010. and create a new Project.
2. In project types select Event Receiver and give it a name (Select .net framework 3.5).
3.Next, In the SharePoint Customization Wizard, choose Deploy as a sandboxed solution and specify the site url
4. Next, in Event Receiver Settings dialog select the “List Item Events” as a type of event receiver and “Custom List” in the Item source drop down. Select “An Item was Added”then click next.
5.Click Finish.
6. Next, In order to Change the Title of an item to the current Data and Time when it is added to a custom list.

 7.Write below code.Press F5 it will start to deploy.
Then check whether it gets activated in Site Actions>site settings>gallery>solutions>Your Project name



  

 8.Create a custom List in that custom List add a new item and refresh the page and view Code works.


Tuesday, 22 November 2011

The vssphost4.exe process was unable to start due to an unknown error or problem

Title: The vssphost4.exe process was unable to start due to an unknown error or problem.
Cause:
  In the SharePoint customization wizard give the local debugging url and choose the option Deploy as a Sandboxed solution then click Next.
 That time a Popup comes and shows the Following error( The vssphost4.exe process was unable to start due to an unknown error or problem.)
Solution:
  Check whether under the same local debugging url so other visual studio project is running or not.
For me it is running so i just restarted my visual studio.Then later on that error got disappered.





Error occurred in deployment step 'Retract Solution': Cannot start service SPUserCodeV4 on computer

Title: SharePoint 2010 Error occurred in deployment step 'Retract Solution': Cannot start service SPUserCodeV4 on computer

Details: Building Sandboxed Solutions on SharePoint 2010 using Visual Studio 2010 Beta and encountered the error? Then make sure that the service Microsoft SharePoint Foundation User Code Service ( CA > System Settings > Services on Server ) is Started.