2016-10-20 14 views
0

acumatica Webサービスを初めて使用しています。ビジネスアカウントの添付ファイルのように添付ファイルとして特定の画面に文書/ファイルをアップロードすることが可能です。acumatica Webサービスを使用してacumatica画面で文書をアップロードする方法

例えば、手動で追加する画面の下に表示されます。

enter image description here

+0

Screen-Based APIまたはContact-Based APIを使用していますか? – RuslanDev

+0

画面ベースのAPIですが、私はattachmentコマンドを使って解決し、ファイルをbase64に変換します –

答えて

2

私は解決策を見つけると誰を助けるために投稿しました。 ファイルをアップロードするには、そのファイルをバイトに変換し、ファイルを変換するバイトを送信する必要があります。

   //Get bytes of file 

      byte[] filedata; 
      using(System.IO.FileStream file = 
      System.IO.File.Open(@"D:\Test.pdf",System.IO.FileMode.Open)) 
      { 
       filedata = new byte[file.Length]; 
       file.Read(filedata,0,filedata.Length); 
      } 

      // Import Data Now to Business Account 

       BAccount.CR303000ImportResult[] lstObjContent = context.CR303000Import 
       (
       new BAccount.Command[] 
       { 
       // Must Pass BusinessAccount in which we want to update or add data 
       new BAccount.Value { Value="XXXXXX",LinkedCommand=objContent.AccountSummary.BusinessAccount}, 
       new BAccount.Value { Value="TestValue123",LinkedCommand=objContent.AccountSetup.CurrentMethod}, 
       new BAccount.Value { FieldName="NameOfFileWithExtension",LinkedCommand=objContent.AccountSummary.ServiceCommands.Attachment}, 
       objContent.Actions.Save 
       },null,new string[][] { new string[] { Convert.ToBase64String(filedata) },new string[] { Convert.ToBase64String(filedata) },} 
       ,false,false,true 
      ); 
関連する問題