Free Support Forum - aspose.com

Open OneNote from SharePoint

Hi,

How to open een OneNote document from SharePoint ?

I have tried this but I get an error :

NotebookLoadOptions loadOptions = new NotebookLoadOptions();
loadOptions.InstantLoading = true;
String inputFile = "notebookTest.one";
string dataDir = "https://sharepoint.company.be/sites/OneNotes/Client5487/";
Notebook notebook = new Notebook(dataDir + inputFile, loadOptions);

System.NotSupportedException: 'The specified path format is not supported'

Hi,


Thank you for contacting Aspose support team.

When we provide a string to onenote document object constructor, it is considered as file name which is searched on network. As no such directory path is found, so it fails. You may try following sample code to read file from web and share the feedback.

Please note that the sample uri is fake and does not contain any onenote file. It contains some other text which is not in onenote document format, therefore format error will rise. But it will demonstrate that text from uri is loaded into onenote file.

var url = https://www.google.com.vn/s?hl=vi&gs_nf=1&tok=i-GIkt7KnVMbpwUBAkCCdA&cp=5&gs_id=n&xhr=t&q=thanh&pf=p&safe=off&output=search&sclient=psy-ab&oq=&gs_l=&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&fp=be3c25b6da637b79&biw=1366&bih=362&tch=1&ech=5&psi=8_pDUNWHFsbYrQeF5IDIDg.1346632409892.1;<o:p></o:p>

var textFromFile = (new WebClient()).DownloadString(url);<o:p></o:p>

byte[] byteArray = Encoding.UTF8.GetBytes(textFromFile);

MemoryStream stream = new MemoryStream(byteArray);<o:p></o:p>

Aspose.Note.Document doc = new Aspose.Note.Document(stream);


If this doens’t help solve your issue, please share your sample OneNote file with us for further investigation at our end. We’ll look into it for assisting you accordingly.

Hi,


Thank you for contacting Aspose support team.

When we provide a string to onenote document object constructor, it is considered as file name which is searched on network. As no such directory path is found, so it fails. You may try following sample code to read file from web and share the feedback.

Please note that the sample uri is fake and does not contain any onenote file. It contains some other text which is not in onenote document format, therefore format error will rise. But it will demonstrate that text from uri is loaded into onenote file.

var url = https://www.google.com.vn/s?hl=vi&gs_nf=1&tok=i-GIkt7KnVMbpwUBAkCCdA&cp=5&gs_id=n&xhr=t&q=thanh&pf=p&safe=off&output=search&sclient=psy-ab&oq=&gs_l=&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&fp=be3c25b6da637b79&biw=1366&bih=362&tch=1&ech=5&psi=8_pDUNWHFsbYrQeF5IDIDg.1346632409892.1;<o:p></o:p>

var textFromFile = (new WebClient()).DownloadString(url);<o:p></o:p>

byte[] byteArray = Encoding.UTF8.GetBytes(textFromFile);

MemoryStream stream = new MemoryStream(byteArray);<o:p></o:p>

Aspose.Note.Document doc = new Aspose.Note.Document(stream);


If this doens’t help solve your issue, please share your sample OneNote file with us for further investigation at our end. We’ll look into it for assisting you accordingly.