Posts

Showing posts from January, 2021

Force synchronization in Microsoft Dynamics AX 2012 using X++

    Dictionary              dictionary;     int                     iLoop;       int                     totalTablesCount;     TableId                 tableId;     Application             application;     SysOperationProgress    progress;     StackBase               errorStackBase;     ErrorTxt                error;     ;     application         = new Application();     dictionary          = new Dictionary();     totalTablesCount    = dictionary.tableCnt();          progress            = new SysOperationProgress();     progress.setTotal(totalTablesCount);     progress.setCaption("@SYS90206");     errorStackBase      = new StackBase(Types::String);     try     {         for (iLoop = 1; iLoop <= totalTablesCount; iLoop++)         {             tableId     = dictionary.tableCnt2Id(iLoop);             progress.setText(dictionary.tableName(tableId));                          application.dbSynchronize(tableId, false, true, false);             progress.incCount();         }     }

How can download attachment file in Microsoft Dynamics AX using DocumentHandlingService and C#(API)?

         public FileResult fileDownload(long  docRefRecId,string fileName)         {                        byte[]                                                    fileByte;             CallContext                                      context = new CallContext();             DocumentHandlingServiceClient  client    = new DocumentHandlingServiceClient();             DocumentFileDataContract           contract;               client.ClientCredentials.Windows.ClientCredential.Domain     = ClientCredential_Domain;             client.ClientCredentials.Windows.ClientCredential.UserName = ClientCredential_UserName;             client.ClientCredentials.Windows.ClientCredential.Password   = ClientCredential_Password;             context.Company = "***";             contract = client.getFile(context, docRefRecId);             fileByte = System.Convert.FromBase64String(contract.Attachment);                          FileContentResult result = new FileContentResult(fileByte, "appli