Save a document to the server machine by client object model

Hi everyone,

                 My requirement is  when a user clicks on 'Go' button in a powerpoint addin, then a powerpoint template is filled with data from a sharepoint list. And then this presentation is to uploaded to a sharepoint library.

The situation is the powerpoint generated from the template gets saved in my local machine. After it is uploaded to the server the presentation is deleted. I dont want to save the temporary file in my local machine but save it  to the 14 hive folder. I am developing this addin using Client Object Model. I cannot access the server where sharepoint is installed.

If 14 hive folder is not accessible by client object model, guide me how to save this presentation in the server.

June 17th, 2015 8:47am

Hi karthik,

To upload a file to the server machine, a workaround is that you can create an Event Receiver contains server side code in the library where you upload the file to. With server side code, we will be able to access the file system of the server machine.

By doing this, when uploading a file to this library using Client Object Model, the Event Receiver will be triggered and save the file to the local drive of the server machine.

Here is a step by step sample on creating a simple Item added event receiver for Custom List in SharePoint 2010:

http://msdn.microsoft.com/en-us/library/ff398052.aspx

More information on Event Receiver for your reference:

http://msdn.microsoft.com/en-us/library/gg749858(v=office.14).aspx

About how to download file to local drive using Server Object Model:

https://social.msdn.microsoft.com/Forums/en-US/598680a2-f5f5-42be-ad18-1eb7b8eba721/download-a-sharepoint-file-using-sharepoint-object-model?forum=sharepointdevelopmentlegacy

Thanks 
Free Windows Admin Tool Kit Click here and download it now
June 17th, 2015 10:19pm

We are not given access to the server where Sharepoint is installed. Everything we do is in Client Object Model. So the event receivers cant help me. I want to access server file systems using only CSOM. The process is

1)User Clicks the Powerpoint addin. Pop-up window shows a dropdown where some parameters are mentioned. User chooses one and clicks 'Generate' button.

2)By utilising CSOM I have coded to take data from sharepoint and fill it in the presentation

3)This presentation is saved in the server file system(if possible 14 hive folder)

4)The saved presentation is uploaded to the sharepoint library.

5)The presentation is deleted from the saved location.(not from library but where it is saved before uploading)

6)The presentation is restored back(i.e data filled are deleted), so that user may choose another parameter.

I did the same procedure by saving the temporary presentation in my local machine. It worked. I want the same process as mentioned above from step 3 to step 6.

June 18th, 2015 3:06am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics