Example #1
0
        public Task DownloadFile(CourseFile file, StudentEvent studentEvent)
        {
            var path = file.ServerRelativeUrl.Replace(Path.GetFileName(file.ServerRelativeUrl), "");

            // Path.Combine(,) ist komisch wenn der zweite Pfad mit einem PathSeperator anfÃĪngt :/
            // siehe dazu https://docs.microsoft.com/de-de/dotnet/api/system.io.path.combine?view=netframework-4.7.2
            path = path.Substring(1);

            path = Path.Combine(studentEvent.CourseName, path);
            var destination = Path.Combine(GetFileStoragePath(), path);

            return(_oscaWebService.DowloadFile(file.DownloadUrl, destination, Path.GetFileName(file.ServerRelativeUrl)));
        }