Bonjour,

Je travaille sur SP2010. Lorsque je crée un fichier avec ce code :

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
private void CompressFile(string inputPath, string outputPath, SPItemEventProperties properties)
        {
            byte[] compressedFile;
            SPList list = properties.List;
            SPWeb currentWeb = properties.Web;
 
            FileInfo outFileInfo = new FileInfo(outputPath);
            FileInfo inFileInfo = new FileInfo(inputPath);
 
            // Compress
            using (MemoryStream msOut = new MemoryStream())
            {
                using (ICSharpCode.SharpZipLib.Zip.ZipOutputStream zipStream = new ICSharpCode.SharpZipLib.Zip.ZipOutputStream(msOut))
                {
                    zipStream.SetLevel(9);
 
                    ICSharpCode.SharpZipLib.Zip.ZipEntry newEntry = new ICSharpCode.SharpZipLib.Zip.ZipEntry(inFileInfo.Name);
                    newEntry.DateTime = DateTime.UtcNow;
                    zipStream.PutNextEntry(newEntry);
 
                    byte[] buffer = new byte[4096];
                    using (FileStream streamReader = File.OpenRead(inputPath))
                    {
                        ICSharpCode.SharpZipLib.Core.StreamUtils.Copy(streamReader, zipStream, buffer);
                    }
 
                    zipStream.CloseEntry();
                    zipStream.IsStreamOwner = true;
 
                   properties.List.RootFolder.Files.Add(currentWeb.Url + "/" + list.RootFolder.Name + "/" + NameWithExt(properties),zipStream,true);
 
                   zipStream.Close();
                }
 
            }
        }
Le système me fait une FileNotFoundException : Fichier introuvable dans c:\windows\system32\inetsrv\fichier.txt

Pourquoi la recherche se fait dans ce répértoire alors que je ne l'ai indiqué nul part ?

Est qu'il prend, par défaut, le répértoire où se trouve l'éxécutable w3wp.exe ?

Merci d'avance de votre aide