Rechercher dans ce blog

mercredi 16 juin 2010

Téléchargement d'un document a partir d'une bibliothèque SharePoint


SPFile filedownload = SPContext.Current.Web.GetFile(chemin complet du fichier);
byte[] fileByte = filedownload.OpenBinary();
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;filename=" + filedownload.Name);
Response.ContentType = "application/pdf";
Response.BinaryWrite(fileByte);
Response.Flush();
Response.End();

Aucun commentaire:

Enregistrer un commentaire