I am creating a presentation via Google.Apis.Slides.v1 in a C# project running on .NET 6.
I downloaded the latest nugget package:
Install-Package Google.Apis.Slides.v1
When trying to export the presentation as suggested by GPT and others.
This is my code:
private void downloadPresentation(SlidesService service, Presentation createdPresentation)
{
// Export the presentation as a PPTX file
var exportRequest = service.Presentations.Exports.Create(createdPresentation.PresentationId, new ExportRequest()
{
ExportFormat = "pptx",
});
var export = exportRequest.Execute();
// Download the exported presentation
var downloadRequest = service.Files.Get(export.Id);
var stream = downloadRequest.ExecuteAsStreamAsync().Result;
string downloadpath = string.Format(@"C:\temp\MyPresentation{0}.pptx", createdPresentation.PresentationId);
using (var fileStream = new FileStream(downloadpath, FileMode.Create, FileAccess.Write))
{
stream.CopyTo(fileStream);
}
Console.WriteLine("File downloaded to: " + downloadpath);
}
I keep getting a compilation error:
'PresentationsResource' does not contain a definition for 'Exports' and no accessible extension method 'Exports' accepting a first argument of type
When I try to make a simple stream download and save it as pptx file it is not valid for any presentation program.
Does anyone have any idea why this happens?
Edit: it seems that as @ProgrammingLlama said there doesn't seem to be a reference for this in the docs. Does anyone know how I can download the file as a true .pptx
?