How to upload Document / File / Image / Report / PDF to SharePoint site from Dynamics AX 2012

From AX 2012, Microsoft introduced the option of uploading a document to share point site from AX using the standard Document management functionality. Now we have a new location type “Share point” in document types form. In order to configure and use Microsoft Dynamics AX document management with Microsoft Sharepoint document libraries follow the steps specified in the below link,

Uploading from X++ code

However, There is a situation when the AX developer wants to upload a document to Sharepoint site from X++ code then the following sample code can be used to upload the document. But the basic setup as mentioned above to configure document management with Sharepoint should be completed before using the below code.

Sample code

static void uploadDocument(Args _args)
    Filename      actualFilePath= "D:\Projects\\testSharePoint.txt";
    Filename      sharePointPath= "\\TestSharepointFromCode2.txt";
        new System.Uri(sharePointPath),

In the above mentioned code,

The variable “actualFilePath” is the actual file path we are going to upload to Sharepoint site and “sharePointPath” is the path of the Sharepoint site.

Thank you !!!


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s