Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SharePoint Development help

Posted on 2010-08-13
1
Medium Priority
?
441 Views
Last Modified: 2012-05-10
Hi,

we had a Custom List Context menu Item in "Actions menu" in SP 2007. and below is the class we used for that. Now if I would like to use the same code for SP 2010, then What will be my eqquivalent Code with SP Ribbon. For your Reference I am also including the Custom Action XML that we used in 2007. Basically, this code used to Create a menu item on the "Actions Menu" of either a document Library or any type of list. So, I am looking for a Button on the List Tab, that appears on all List Views for list and all Views of Document Library. When a user Clicks on that Button then the user is directed to a URL mentioned in the Code below. Let me know if it is not clear or need more info.



Custom Action XML:

<CustomAction Id="SomeCustom.Action" Location="Microsoft.SharePoint.StandardMenu" GroupId="ActionsMenu" Sequence="20" ControlAssembly="Some Key" ControlClass="Class mentioned below" />

Class Referenced in Above CustomXML

using System;

using System.Collections.Generic;

using System.Text;

using System.Web.UI;

using System.Web.UI.WebControls;

using Microsoft.SharePoint;

using Microsoft.SharePoint.WebPartPages;

using Microsoft.SharePoint.WebControls;

namespace MyNameSpace

{

public class MyClass : WebControl

{

protected override void OnLoad(EventArgs e)

{

EnsureChildControls();

base.OnLoad(e);

}

protected override void CreateChildControls()

{

ListViewWebPart listView = FindListView(Parent);

if (listView == null)

return;


MenuItemTemplate menu = new MenuItemTemplate();

menu.Title = "My Title";

menu.Text = "My Title";

menu.Description = "My Description";

menu.ImageUrl = "/_layouts/images/lg_icasax.gif";

menu.Sequence = 20;



SPWeb web = SPContext.Current.Web;



string urlFormat = "someURL";

string fullUrl = string.Format(urlFormat,

web.Url,

listView.ListName,

listView.ViewGuid,


System.Web.HttpUtility.UrlEncode(filterString)

);

menu.ClientOnClickScript = fullUrl;

Controls.Add(menu);

base.CreateChildControls();

}



}

}

Thanks in Advance,




0
Comment
Question by:Techsavy
1 Comment
 
LVL 21

Accepted Solution

by:
chapmanjw earned 2000 total points
ID: 33598253
Here is Microsoft's tutorial on creating custom actions on the ribbon in 2010: http://msdn.microsoft.com/en-us/library/ms473643.aspx
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Scenario: Let’s say you have a quote worksheet in Excel that you use to work up sales figures and such for your clients. You utilize SharePoint to manage and keep track of these documents. You would like values from your worksheet to populate Sh…
Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question