My task:
Build a window service (build a C# console app beforehead) to auto print using the default printer any PDF files added to a specific document library in SharePoint.
I found codes for printing PDF from the local directory but have problem in the SharePoint part.
I am new to c# and SharePoint programming and I do not know where to start from. Any help would appreciate!
Problem:
Should I directly get files from SharePoint or download it to local pc (and delete it after print job) before doing the printing part?
If I am to get file directly from SharePoint, I tried to apply the following codes with namespace: using Microsoft.SharePoint.Client; and Microsoft.SharePoint.Client.dll in the lib of the current pj but get error.
using (SPSite site = new SPSite(url)) { using (SPWeb web = site.OpenWeb()) { SPFile file = web.GetFile(url); } }
Error: The type of namespace name SPSite/SPFile/SPWeb could not be found.
All in all what skills/methods should I use in tackling the task?
- Auto monitor a SharePoint doucment
- Retrieve the PDF file
- Print the PDF