AL icon indicating copy to clipboard operation
AL copied to clipboard

ERROR : The type or method CreateBook cannot be used for Extension development.

Open srinivasdes opened this issue 8 years ago • 5 comments

Facing above error while convert our extension from V1 to V2

srinivasdes avatar Jan 09 '18 08:01 srinivasdes

Please read the FAQ

Please provide more than a function name. E.g. built-in or objecttype+id.

esbenk avatar Jan 09 '18 11:01 esbenk

The table "Excel Buffer" has methods that are not allowed for 'Extension' development such as 'CreateBook', 'OpenBook'. I have read the FAQ and I know that I can change my target to Internal, but if I want to create a real extension that can read and write Excel files, what options do I have? I'm assuming that the MSDyn365BC product will include the ability to import a budget from Excel and export a budget to Excel, so why can't we do the same in our own extensions? If there is a work-around for this, can you please provide some details on how an Extension could be written to import and Excel spreadsheet.

DavidRoys avatar Mar 20 '18 23:03 DavidRoys

The problem with the CreateBook and OpenBook functions is, that they use files, which aren't allowed in BC extension development. The solution to this problem is to use streams instead of files. For OpenBook, we've implemented the alternative OpenBookStream, which you can use instead. The CreateBook alternative for now is CreateNewBook, but we still have some refactoring to do, as that function does use a tempfile in the background. That is work in progress. But you should be able to unblock yourself by using those two replacement functions. I hope that helps! If you have further questions, please let me know!

JesperSchulz avatar Mar 21 '18 08:03 JesperSchulz

Thanks to everyone.

i am using streams to fulfill my requirement

srinivasdes avatar Mar 21 '18 09:03 srinivasdes

Glad I could help :-) If you run into other problems, please reopen this issue or create new one.

JesperSchulz avatar Mar 21 '18 09:03 JesperSchulz