microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
728 stars 241 forks source link

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

Closed srinivasdes closed 6 years ago

srinivasdes commented 6 years ago

Facing above error while convert our extension from V1 to V2

esbenk commented 6 years ago

Please read the FAQ

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

DavidRoys commented 6 years ago

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.

JesperSchulz commented 6 years ago

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!

srinivasdes commented 6 years ago

Thanks to everyone.

i am using streams to fulfill my requirement

JesperSchulz commented 6 years ago

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