我已经使用附件ID来获取附件详细信息,使用其执行的rest api并从rest api获取文档但是如何阅读此附件并保存在物理文件夹中,无论附件是否为zip文件pdf,文件?
public Attachment GetAttachment(string attachmentId)
{
var request = new RestRequest()
{
Method = Method.GET,
Resource = ResourceUrls.AttachmentById(attachmentId),
RequestFormat = DataFormat.Json
};
return Execute<Attachment>(request, HttpStatusCode.OK);
}
public class Attachment
{
public string self { get; set; }
public string filename { get; set; }
public Author author { get; set; }
public string created { get; set; }
public int size { get; set; }
public string mimeType { get; set; }
public string content { get; set; }
public string thumbnail { get; set; }
}
但如何阅读附件?
答案 0 :(得分:0)
getContent()然后base64解码返回的字符串,我相信。内容类型是根据附件上传时的名称(扩展名)设置的,可用于确定解码附件内容中的数据类型。