Is it allowed to generate temporary files? - ms-office

I have not yet submitted any Office add-in.
For the add-in I am developing, a JavaScript function will generate a temporary .txt file, which will be treated by another JavaScript function. Does anyone know if the server of Office Add-ins permits of generating temporary files like that?
Is there any example in https://github.com/OfficeDev that uses temporary file?
If it is not allowed, which would be the data type to represent large unstructured information (like text) to be passed among JavaScript functions?

Since all web-based Office add-ins use JavaScript, you have no interaction with the local PC nor the web server where the add-in's pages are hosted. If you need to do file manipulation you could for example call REST endpoints (via Ajax from your JavaScript) on your web server which could use server-side code (such as the ASP.NET Web API, NodeJS, etc.) to do the file work and return results to your JS code.

Related

SharePoint Add-ins and SharePoint Framework

I'm trying to understand the difference between the SP add-ins and SP Framework.
I need to refactor a Django app on SP online. The web app does the following:
Takes input from the user into a form (mostly y/n) questions
based on the responses generates a pdf document which is returned to the user plus a .docx document which is stored on SP (the end user has no access to the .docx)
Potentially sends an email to notify other stakeholders
Now, if I have to implement it on SP, I understand that the full logic will be in the client, while at the moment for example part of the logic runs in Python.
The form itself should not be an issue. I was wondering how to generate the pdf and the docx. Is that possible using SP workflows? Or should I use Power Automate? I mean, how to properly populate a HTML/word template and then convert it to Pdf if we have no access to server side code? Thanks
You can create a SharePoint Application using spfx framework https://learn.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-framework-overview and the client side code can call server side APIs. You could use any backend to take the Form submission and return a generated PDF file.
Please find below my thoughts:
-UI and backend base logic(capturing form data) you can do with SpFx.
PDF Generation: There are few client side js scripts(e.g., jspdf)
available to generate a pdf. This can be done from SpFx. We did generated this one of the project but it was console app using csom.(but we used js files for pdf generation)
Word file generation: Power Automate can be handy here, which uses a
premium connector to convert. You might need to rely on onedrive for that.
Or
Azure Function: you can write Azure Function for the conversion
logic(pdf/docx)
API: as astanley86 said, you can create the API (takes care of conversion) and call it from spfx
SpFx is the modern development approach which is recommended by MS. SP Add-in has few cons which you can easily find from knowledge base.

Embed Excel in a website to edit a locally stored document

Is it possible to embed google excel in my website to edit document stored locally?
My manager asked me if it is possible to integrate the Microsoft office webapp in my own website.
Clients have excel files stored on our website, we want to know if it is possible for them to open the file with a web excel page, edit the file and save the modifications. For now, they use SharePoint so it is easy for them but we intend to use an other platform.
Our client can have all the license we need.
I searched but I didn't find any solution.
I know you should be able to do this with ASP and the .Net Framework. SharePoint uses ASP pages, so you may try to do something simpler.
If you go over the Internet you'll see several solutions because people do this too.
e.g. a thing you can do is to use Open XML API to do this, and it is like reading / modifying a flat file on the server. A restriction is it has to be .xlsx / 2007 format onward.

Create multiple tabs on excel via classic asp

I can export to page as excel file via this code below:
response.contenttype = "application/vnd.ms-Excel"
response.Addheader "content-disposition", "attachment; filename=test.xls"
But I want to create multiple tabs on the same excel file, how I can do it?
Thanks for helps.
You cannot do that using the response.contenttype directive. that command only transforms a page into excel so you do not have the ability to create a new page as all of your html will be read as one page.
The solution depends on what your requirements are.
Free
The only free solution I know is building a page and pushing it to the browser as an XML file. If you create the file you want in excel and then save it in an XML format, you can open that file and see how the page should be build in asp.
Pros Its free. you do not need permission to install anything to the server. You will just be passing an xml file to the client.
Cons Excel is not the default viewer for xml files, notepad usually is. Most people will not understand how to open your file in excel. This means that this method is really only good for internal applications where you can change everyone's computer to open XML files in Excel by default.
3rd Party Program
When I needed to accomplish this same task I had entertained using 3rd party programs in classic asp. I wish I could remember the program but it would have cost around ~$1,000 to use.
Pros These programs are feature rich and will allow you to do anything you could want in exporting to excel. They are also cleaner and a bit simpler to use over writing your own XML file to open in excel.
Cons Costs money. may require server permissions you do not have. Most programs require you to save the file to the server before serving it to the client
ASP.NET
You can choose to instead create a new page in asp.net and use its excel features to create the file you need.
Pros Also free. Same extensive feature set available in most 3rd programs for classic asp are available with this method.
Cons classic asp and .net are not able to communicate directly so things like password protection on the page will become an issue if that is needed. You obviously need to know or learn the .net framework. Files are saved to the server before being sent to the client.

Using SAS to write to external Sharepoint library

I need a routine for loading files (.html) onto a sharepoint library using SAS. The site is outside the firewall (am unable to use the 'map network drive' method).
The sharepoint library is configured with 'No versioning' etc, and my username / password has administrator privileges..
I believe there are easier ways (tools) to do it than SAS, so I'd just let SAS call some other process - e.g. if your SAS is on Windows, it could call (even generate) a Powershell script.
This http://poshcode.org/2122 seems to be a way.
I've done something similar with SAS calling curl to upload files to SAS webDAV server.
If you'd like a pure SAS way - it should be doable using new PROC HTTP as a web service call.
Refer to
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a003286672.htm for SAS side and probably this http://msdn.microsoft.com/en-us/library/ff798339.aspx
for Sharepoint side.
Anyway, PROC HTTP seems interesting for some easier things.
I don't think you can use plain old SAS to do this. If you have the SAS Enterprise BI Server product, there is a component called "SAS Web Parts for Microsoft SharePoint", but that is really an interface between Sharpoint and the BI server (so you can display dashboards or run stored processes).
The "easiest" thing to do is create your html files and then use FTP to copy then to the SharePoint server. Of course, this requires an FTP server on the other end and you would want to engage the help of the Sharepoint administrator. I've done something similar myself. I don't know SharePoint myself but there is a way to set it up so that all content that shows up in a directory is automatically recognised.
There may be other solutions and I'd love to see them as well.
Sharepoint has this wonderful web interface. Basically what you do is open your web browser, works best in IE8+ and navigate to your site URL and open your document library. If you select Items in the Ribbon you can upload a document using their interface. :)
SharePoint already exposes several options, using legacy web service and the new rest services.
http://msdn.microsoft.com/en-us/library/ff798339.aspx

How to access SharePoint files and folders from outside SharePoint?

I need to programatically interface with SharePoint folders, files and lists from outside SharePoint. Most tutorials focus on working within SharePoint itself, or at least on the same server where SharePoint is installed. I need to automate some tasks from completely different servers -- tasks that require reading SharePoint lists, browsing folders, checking files out and in, reading files stored in SharePoint libraries, etc. It used to be easy using UNC folder and file paths. Now many of our SharePoint sites don't allow UNC access (probably for good reasons), but my needs are the same. What languages / libraries / interfaces will allow this? I'd like to be able to do this from server-side .NET code and from PowerShell scripts (not on the SharePoint server). Thanks for any pointers.
SharePoint offers a web services API. I won't claim it's particularly friendly or fun, but it does work. You can get started learning here.
Use Sharepoint Web Services which provides a suite of standard web service endpoints you can use to do most anything you can through the objet model API.
You can use SPServices whichis a jQuery library which abstracts SharePoint's Web Services and makes them easier to use. It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities. It works entirely client side and requires no server install.
Here's anoth example of SPServices in use Example
if you are using SharePoint 2010 you can use the Client Side Object Model (http://msdn.microsoft.com/en-us/library/ee537247(v=office.14).aspx). It will help you to access sharepoint objects, lists and everything. There are 3 types one for C#, Silverlight and Javascript.
there are more than one methods:
use csom (client side object model)
use rest services
use sharepoint out of the box web services.
If you want to be able to choose the language in which you program, I'd recommend using the Sharepoint REST API. I'm writing my service in Java, requesting data in JSON, and using Jackson to parse it into Java Objects.

Resources