Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="teamId"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public Message Download(string teamId, string fileName)
        {
            string       LIBRARY_NAME = "KPReports";
            SPDataAccess spDataAccess = new SPDataAccess();
            MemoryStream stream       = spDataAccess.GetFileStream(Int32.Parse(teamId), LIBRARY_NAME, fileName);
            Message      responseMsg  = this.ctx.CreateStreamResponse(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

            if (stream != null)
            {
                stream.Dispose();
            }

            return(responseMsg);
        }
Esempio n. 2
0
        public void LoadFile(MappingData mappingData)
        {
            if (mappingData.FileName.Contains("xlsx"))
            {
                this.containsWorksheets = true;
            }

            try
            {
                //this.fileStream = spDataAccess.GetFileStream(mappingData.Team.SiteUrl, mappingData.LibraryName, mappingData.FileName);
                this.fileStream = spDataAccess.GetFileStream(string.Empty, mappingData.LibraryName, mappingData.FileName);
            }
            catch (Exception ex)
            {
                string errMsg = string.Format("Cannot open file: {0}/{1}; {3}", mappingData.LibraryName, mappingData.FileName, ex);
                throw new Exception(errMsg, ex.InnerException);
            }
        }