ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
JavaとSuiteTalkを使用してファイルキャビネットにファイルをアップロードする
適用
製品: NetSuite 2020.1
シナリオ
ユーザーは、JavaとSuitetalkを使用して、ローカルファイルを自分のNetsuiteアカウントのファイルキャビネットにアップロードしたいと考えています。
解決策
このサンプルコードは、その方法を示しています。
注:このコードはサンプリングのみを目的としています。
public void uploadFile() { try { String filePath = "C:\\Documents and Settings\\bsicam\\My Documents\\My Pictures\\testPDF.pdf"; java.io.File localFile = new java.io.File(filePath); byte []buffer = new byte[4096]; ByteArrayOutputStream ous = new ByteArrayOutputStream(); InputStream ios = new FileInputStream(localFile); int read = 0; while ( (read = ios.read(buffer)) != -1 ) { ous.write(buffer, 0, read); } if(ous != null) { ous.close(); } ios.close(); byte[] byteArray = ous.toByteArray(); File newFile = new File(); newFile.setContent(byteArray); newFile.setName("testPDF.pdf"); newFile.setEncoding(FileEncoding._utf8); newFile.setAttachFrom(FileAttachFrom._computer); newFile.setFileType(MediaType._PDF); newFile.setFolder(new RecordRef("", "-4", "", RecordType.folder)); WriteResponse uploadResponse = port.add(newFile); if
タグ付けされた:
0