Upload the Documents through X++

Below code is to upload the documents to AX through X++:


static void Mzk_DocUploadTest(Args _args)
{
    DocuRef docuRef;
    DocuActionArchive archive;
    CustTable _custtable;
    str _name;
    ;
    
    _name=@"c:\\shivaTest.docx";
    
    select RecId from _custtable where _custtable.AccountNum =="MTSP-000001";
    
    if (_custtable!=null)
    {
        ttsBegin;
            docuRef.clear();
            docuRef.RefRecId = _custtable.RecId;
            docuRef.RefTableId = tableNum("custtable");
            docuRef.RefCompanyId = curext();
            docuRef.Name = _name;
            docuRef.TypeId = 'File';
            docuRef.insert();
            archive = new DocuActionArchive();
            archive.add(docuRef, _name);
        ttsCommit;
    }
}

Advertisements

Using HtmlTextWriter class in x++


static void HTMLTextWriter(Args _args)
{
    HTMLTextWriter htw = new HTMLTextWriter();
    TextBuffer     txtBuffer = new TextBuffer();
    CCHTMLString   staticString;
    ;

    staticString = @'Test Message to show on browser.';
   
    htw.renderBeginTag(HtmlTextWriterTag::table());
    htw.renderBeginTag(HtmlTextWriterTag::tr());
    htw.write(staticString);
    htw.addAttribute(HtmlTextWriterAttribute::class_Attribute(), 's-vb');
    htw.addStyleAttribute(HtmlTextWriterStyle::width(), '26px');
    htw.addStyleAttribute(HtmlTextWriterStyle::padding_top(), '3px');
    htw.renderBeginTag(HtmlTextWriterTag::td());
    htw.addAttribute(HtmlTextWriterAttribute::src(), 'https://erpdax.files.wordpress.com/2015/07/cropped-microsoft-dynamics-ax.jpg');//get the image from web
    htw.addStyleAttribute(HtmlTextWriterStyle::width(), '550');
    htw.addStyleAttribute(HtmlTextWriterStyle::height(), '150');
    
    htw.renderBeginTag(HtmlTextWriterTag::img(), true);
    
    htw.renderEndTag();
    //close <Td>
    
    htw.renderEndTag();
    //close <Table>
    
    txtBuffer.setText(htw.getHtmlString());
       
    txtBuffer.toFile('C:\\DynamicsAX.html');  // please provide your path to save the file
    
}

The Result will be:
Test

To Open Visual Studio with a Specific Configuration from a Shortcut

To Open Visual Studio with a Specific Configuration from a Shortcut

On the client computer that is running Visual Studio, open the
Start menu, right-click Visual Studio 2010, and select Properties.

Update the Target field and add the /AxConfig
switch with either the name of the client configuration or the name of the client configuration file as shown in the following

examples:

“C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe” /AxConfig AX-Client-CUS(Configuration name)       

 or

“C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe” /AxConfig z:\Config\ContosoDev.axc

If you run the Visual Studio executable with a parameter of /?, then it will show you all the available switches you can use.

Note:
When pointing to a configuration file, you can use a Universal Naming Convention (UNC) file location such as \\Server\Configurations\ContosoDev.axc.

Click OK. When you click the Visual Studio shortcut, it opens and Application Explorer points to the specified client configuration. The name of the configuration appears at the top in the root node of Application Explorer.