Generating filename for download from metadata
-
2012年6月7日 12:23Can i customize the file copy / file download mechanism from a document library so that the filename is not taken from the "name" field but generated based on other attributes? Could this be made even made configurable in the configuration screen of a library.
全部回复
-
2012年6月11日 2:40版主
the download a copy ECB menu item calls the /_layouts/download.aspx;
And download.aspx inherits download class in microsoft.sharepoint.applicationpages.dll; you can file that the filename information is specified in AddContentDispositionHeader method of the download class as below:
base.Response.AppendHeader("Content-Disposition", "attachment;filename=\"" + SPHttpUtility.UrlEncodeFilenameForHttpHeader(fileName) + "\"");
So, you may create your own ASPX page for download, with your own custom code behind based on the out of box download class, and add your own ECB menu item as custom action;
Alternatively, you can just change the filename with javascript new FileStream(filename, filemode.create) as described in http://blogs.msdn.com/b/ramg/archive/2009/02/08/downloading-files-from-document-library-remotely-without-any-om-code.aspx
- 已编辑 GuYumingMicrosoft Contingent Staff, Moderator 2012年6月11日 2:40
- 已标记为答案 GuYumingMicrosoft Contingent Staff, Moderator 2012年6月15日 9:08

