/// <summary> /// 取附件列表 /// </summary> /// <param name="formid">表单ID</param> /// <returns>string</returns> public static string GetAttachList(string formid) { FileUploadService fileuploadClient = new FileUploadService(); StringBuilder stringBuilder = new StringBuilder(); var attach = fileuploadClient.GetFileListByOnlyApplicationID(formid); stringBuilder.Append("<AttachList>"); if (attach.FileList != null) { for (int i = 0; i < attach.FileList.Count(); i++) { string path = attach.FileList[i].FILEURL; string filename = path.Substring(path.LastIndexOf('\\') + 1); string filepath = HttpUtility.UrlEncode(attach.FileList[i].FILEURL + "\\" + attach.FileList[i].FILENAME); string url = attach.DownloadUrl + "?filename=" + filepath;//文件地址 //sb.Append("<a href=\"" + url + "\" >" + filename + "</a>"); stringBuilder.Append("<Atrribute Name=\"" + attach.FileList[i].FILENAME + "\" Url=\"" + url + "\" />"); } } stringBuilder.Append("</AttachList>"); return(stringBuilder.ToString()); }
/// <summary> /// 取附件列表 /// </summary> /// <param name="formid">表单ID</param> /// <returns>string</returns> public static string GetAttachList(string formid) { FileUploadService fileuploadClient = new FileUploadService(); StringBuilder stringBuilder = new StringBuilder(); var attach = fileuploadClient.GetFileListByOnlyApplicationID(formid); stringBuilder.Append("<AttachList>"); if (attach.FileList != null) { for (int i = 0; i < attach.FileList.Count(); i++) { string path = attach.FileList[i].FILEURL; string filename = path.Substring(path.LastIndexOf('\\') + 1); string filepath = HttpUtility.UrlEncode(attach.FileList[i].FILEURL + "\\" + attach.FileList[i].FILENAME); string url = attach.DownloadUrl + "?filename=" + filepath;//文件地址 //sb.Append("<a href=\"" + url + "\" >" + filename + "</a>"); stringBuilder.Append("<Atrribute Name=\"" + attach.FileList[i].FILENAME + "\" Url=\"" + url + "\" />"); } } stringBuilder.Append("</AttachList>"); return stringBuilder.ToString(); }