Solved

SharePoint Development help

Posted on 2010-08-13
1
429 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Move SharePoint data to a new server 3 81
VBA in SharePoint 3 61
SBS 2011 Need to move SharePoint Foundation datab ases 2 37
File share migration to Sharepoint online 5 34
If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…

734 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