1
votes

as a newbie to Sharepoint.... I have created a simple list with several columns in Sharepoint 2010.

I now want to add a button on the List that I can programmatically add some onClick events to do the following:

  • get a handle on some of the columns in the list;
  • Distribute an email automatically based on the content of some of the columns

I am looking at using c# via Visual Studio 2010 for all the programmatic aspect of this development.

Is it possible to export the xml from Sharepoint 2010 then import into Visual Studio 2010 so that I can use the list I created as my starting point for the coding work? If so, how do I go about this?

Thanks.

1

1 Answers

2
votes

You'll have to setup Visual Studio to work with Sharepoint. Install it on a server that has Sharepoint 2010 running.

You can then create a webpart that incorporates the list (or a view on it) and add the button to that list.

But I imagine that you'll want to work on a specific row. So what you want is a Custom Action on that list (Visual Studio has a template for that: Add -> New Item -> Custom Action). The Custom Action will create a new item in the Edit Control Block (the context menu that appears for every item in the list).

I prefer to create the ECB (Edit Control Block) menu items using JavaScript. In the page load I inject a jSon string that has additional information about each of the rows, and a JavaScript function then is called by the builtin SharePoint javaScript function that creates the ECB.

The JavaScript function you'll have to create is Custom_AddListMenuItems .

In that function you'll call CAMOpt to create menu items. If you want SharePoint to create the built-in menu items (and Custom Actions you created), set the return value of the Custom_AddListMenuItems function to true. (And fals if you don't want to see the built in ECB menu items and any Custom Actions you created)

You can start here:Jan Tielens Blogging's

Hope this helps.