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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s