Ejemplo n.º 1
0
        public static DownloadReult GetSuccessResult(string spUrl)
        {
            DownloadReult res = new DownloadReult();

            res.Success = true;
            res.SpUrl   = spUrl;

            return(res);
        }
Ejemplo n.º 2
0
        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);
        }