Boa tarde a todos.
Estou um problema aqui... Preciso fazer o download de arquivos que estão em uma lista quando o usuário clicar em um link que envio por email. Para documentos .doc, .xls, .ppt, .pdf funciona perfeitamente. Contudo quando são arquivos
do tipo template(.dotx, .dot) o sistema faz o download mas os meta dados( campos da lista) são exibidos no documento. Alguem já passou por isso? Segue o código que estou utilizando:
private void DownloadArquivo()
{
SPWeb web = null;
byte[] binfile = null;
string urlDownload = "";
string nameFile = "";
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite site = new SPSite(SPContext.Current.Web.Url);
web = site.OpenWeb();
Guid idLista = web.Lists["ItensTemporarios"].ID;
SPDocumentLibrary list = (SPDocumentLibrary)web.Lists[idLista];
urlDownload = list.RootFolder.Files[0].Url;
//********
SPFile fileDownload = web.GetFile(urlDownload);
nameFile = fileDownload.Name;
binfile = fileDownload.OpenBinary();
});
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/force-download";
Response.AppendHeader("content-disposition", "attachment; filename=" + nameFile);
Response.BinaryWrite(binfile);
Response.Flush();
Response.End();
}
MCTS Sharepoint Application Development