Removing attachment from onenote document

Dear Aspose Support Team,

I hope this email finds you well. I am writing to inquire about how to remove an attachment from a OneNote document using Aspose software.

Specifically, I am looking for guidance on how to use a command or code to achieve this. I have already reviewed the documentation on your website, but I was unable to find a clear solution to my problem.

Would you be able to provide me with some guidance or a sample code snippet that can be used to remove an attachment from a OneNote document using Aspose software?

Thank you in advance for your assistance.

Best regards,

@avalentia,

The attached files to OneNote document can be manipulated. These files are stored in AttachedFile nodes. The AttachedFile class represents an attached file. You can use Document.GetChildNodes method get AttachedFile nodes. See the following sample code for your reference:
e.g.
Sample code:

// Load the document into Aspose.Note.
Aspose.Note.Document oneFile = new Aspose.Note.Document("Sample1.one");

// Get a list of attached file nodes
IList<Aspose.Note.AttachedFile> nodes = oneFile.GetChildNodes<Aspose.Note.AttachedFile>();
            
// Iterate through all nodes
foreach (Aspose.Note.AttachedFile file in nodes)
{ 
     //your code goes here if you want to retreive attached files.
}

//Remove attached file at first index
nodes.RemoveAt(0);

//remove all nodes
nodes.Clear();

Also, see the document on attachments for your reference.

Hope, this helps a bit.