Solved

SharePoint Development help

Posted on 2010-08-13
1
409 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 500 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

I recently came across an issue with a MOSS 2007 deployment where access into some sub-sites were denied, even for the MOSS farm administrators. A bit of background to the setup of this MOSS farm; this was a three server setup, consisting of a fr…
SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 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