none
Download file from library using PHP RRS feed

  • Question

  • Hello,

    I would like to allow user in a site developed in PHP to download files hosted in Office 365 SharePoint site. I am able to get links of documents hosted in SharePoint. So clicking on these links should allow users to download files on their machine.

    I am relatively new to PHP and tried doing it with curl but couldn't do it. Appreciate if someone can guide using code samples.

    Thanks in advance.

    Monday, January 16, 2017 8:41 AM

All replies

  • You need to use JavaScript CSOM to do this.

    https://msdn.microsoft.com/en-us/library/office/jj163201.aspx

    Reference to "Create, read, update, and delete files" section.

    chanmm


    chanmm

    Monday, January 16, 2017 8:49 AM
  • I believe JavaScript CSOM can be used when the script is added on a SharePoint page/web part. reference

    Since users will be clicking the links from PHP site I dont think JavaScript CSOM will work.

    Please correct me if I am wrong.

    Monday, January 16, 2017 9:05 AM
  • Another way is using the CSOM in C# exposes it as web services so php can call the services.

    I always use CSOM C# in standalone exe, winform, and wenform so I am so this one don't need to be webpart.

    chanmm


    chanmm

    Monday, January 16, 2017 9:16 AM
  • Thanks Chanmm!

    Yes, I tried creating a .net web service and using that I am able to download the file.

    But from client's perspective it is an overhead for hosting a .net service. So client want it everything in PHP.

    Monday, January 16, 2017 9:29 AM