Bonjour j'ai mis en place plusieurs custom action sur mon site avec succès.
Maintenant je souhaiterai mettre en place des custom action (location ECB)avec du code behind dérrière (C#). après avoir explorer le net j'ai mis ceci en place :

(Le but étant la de créer un fichier bidon sur c: )

element.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 
	<CustomAction
	Id="WriteDocId"
Title="Write Doc ID to Text File25"
Location="EditControlBlock"
Description="Write Doc ID to Text File22"
RegistrationType="List"
RegistrationId="101"
ShowInLists="TRUE">
<UrlAction Url= "javascript:__doPostBack('MyEventTarget',{ItemId});" />
		</CustomAction>
 
	<CustomAction
 Id="UserInterfaceCustomActions.SiteActionsToolbar"
 GroupId="SiteActions"
 Location="Microsoft.SharePoint.StandardMenu"
 Sequence="1000"
 Title="MY SITE ACTIONS BUTTON"
 ControlAssembly="LaunchDocItemCustEvent, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f470aeb4974a4f0"
ControlClass="LaunchDocItemCustEvent.LaunchDocWriter"
 >
</CustomAction>
 
</Elements>

feature.xml

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0" encoding="utf-8"?>
<Feature  Id="9752d2c5-559e-47f5-9851-9ab033422f32"
          Title="WriteTextFile"
          Description="Write Doc Item to text File"
          Version="12.0.0.0"
          Hidden="FALSE"
          Scope="Site"
          DefaultResourceFile="core"
          xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="elements.xml"/>    
  </ElementManifests>
</Feature>

LaunchDocWriter.cs
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Utilities;
using System.IO;
 
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Text;
 
 
public class LaunchDocWriter : SPLinkButton
{
    protected override void OnLoad(EventArgs e)
    {
        this.EnsureChildControls();
        base.OnLoad(e);
 
 
        if (this.Page.Request["__EVENTTARGET"] == "MyEventTarget")
        {
 
 
            if (!Directory.Exists(@"C:\temp"))
                Directory.CreateDirectory(@"c:\temp");
 
            Random rnd = new Random();
            String random = rnd.Next().ToString();
            String fileName = @"c:\temp\" + random + ".docx";
            FileStream file = new FileStream(fileName, FileMode.Create);
 
            if (!Directory.Exists(@"C:\toto"))
                Directory.CreateDirectory(@"c:\toto");
 
 
        }
    }
}
D'après ce que j'ai compris a travers de nombreux tutoriaux l'ajout d'un control assembly et d'un control class sur un méme custom action ne marche pas il faut donc passer par un custom action qui permet d'encapsuler et d'utiliser le code behind. c'est ce que je fais et pourtant ce la ne marche pas. Est-ce que je m'y prend mal et si oui comment puis je faire pour remèdier a mes érreurs