public static DownloadReult GetSuccessResult(string spUrl) { DownloadReult res = new DownloadReult(); res.Success = true; res.SpUrl = spUrl; return(res); }
public ISpDownloadResult DownloadFileFromSharePoint(string fileServerRelUrl) { byte[] fileData = null; DownloadReult res = DownloadReult.GetSuccessResult(fileServerRelUrl); try { using (var ctx = _connection.GetContext()) { var fi = Sp.File.OpenBinaryDirect(ctx, fileServerRelUrl); fileData = ReadFully(fi.Stream); } res.SetFinisced(fileData); } catch (Exception ex) { res.SetError(ex); } return(res); }