Feature action list settings

Source: Internet
Author: User
Today is a rogue .. Very painful... Very depressing. ....

First, code. CS

Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. text;
Using system. Web;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using Microsoft. SharePoint;
Using Microsoft. Sharepoint. webcontrols;
Namespace actiondemo
{
[Defaultproperty ("text")]
[Toolboxdata ("<{0}: listsettingsmenu runat = Server> </{0}: listsettingsmenu>")]
Public class listsettingsmenu: webcontrol
{
[Bindable (true)]
[Category ("appearance")]
[Defaultvalue ("")]
[Localizable (true)]
Public String text
{
Get
{
String S = (string) viewstate ["text"];
Return (S = NULL )? String. Empty: S );
}

Set
{
Viewstate ["text"] = value;
}
}

Protected override void createchildcontrols ()
{
// Base. createchildcontrols ();
Submenutemplate listsettings = new submenutemplate ();
Listsettings. Text = "list Settings ";
Listsettings. Description = "manage settings for lists on this site ";
Listsettings. imageurl = "/_ layouts/images/lg_icascx.gif ";

Foreach (splist list in spcontext. Current. Web. Lists)
{
If (! List. Hidden)
{
Menuitemtemplate listitem = new menuitemtemplate ();
Listitem. Text = List. title;
Listitem. Description = string. Format (
"Manage settings for {0}", list. Title );

Listitem. imageurl = List. imageurl;

String url = string. Format (
"{0}/_ layouts/listedit. aspx? List ={{ 1 }}}",
Spcontext. Current. Web. url, list. Id. tostring ());
Listitem. clientonclicknavigateurl = URL;

Listsettings. Controls. Add (listitem );

}
}

This. Controls. Add (listsettings );
}
Protected override void rendercontents (htmltextwriter output)
{
Output. Write (text );
}
}
}



Feature
Feature. xml

<Feature xmlns = "http://schemas.microsoft.com/sharepoint"

Id = "{abeaae41-f8bc-4d60-b793-1ab65e633009 }"
Title = "AA is great"
Description = "Default site actions menu of WSS site by adding extra menu options ."
Scope = "Site"

>
<Elementmanifests>
<Elementmanifest location = "manifest. xml"/>
</Elementmanifests>

</Feature>

Manifest. xml

<Elements xmlns = "http://schemas.microsoft.com/sharepoint/">

<Customaction id = "{99777c4a-55d9-459b-aefe-e38b0d610ee1 }"
Location = "Microsoft. Sharepoint. standardmenu"
Groupid = "siteactions"
Controlassepolicy = "actiondemo, version = 1.0.0.0, culture = neutral, publickeytoken = bf2af071df56a875"
Controlclass = "actiondemo. listsettingsmenu"
>
</Customaction>

</Elements>

DLL in GAC or bin

Then place the two XML files
Create a folder under feature

Register this DLL in the website's web. config file
I don't need to write this .. Generally, all webparts are required ..

Then install

 

@ Set templatedir = "C: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \"

@ Set stsadm = "C: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ bin \ stsadm"

Xcopy/e/y template \ * % templatedir % \ Template

@ Echo on

REM % stsadm %-O installfeature-name mycustomlistsettings-Force
REM % stsadm %-O activatefeature-name mycustomlistsettings-force-URL http: // server: 8000/

Rem iisreset/Timeout: 0

Customaction can be set to Microsoft. Sharepoint. standardmenu

Of course, you can set everything else... Use your imagination. /...

The Code has no value .. It's just a way...

Today is annoying ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.