Download file from Sharepoint - AX 2012

Hello All,
I am trying to download the file from Sharepoint online via code in AX 2012 R3 but getting error.
I have implemented a C# library in which I am passing the complete URL of the file along with user name and password but cannot succeed.
Has anyone achieved via direct X++ code or via a C# library ?
Help will be appreciated.

Could you give us more information about the error, please?
What does it say and which method is it throwing?