const credentialOptions = { username: '', password: '' };
const spr = sprequest.create(credentialOptions);
spr.get('http://mysites/User%20Photos/Profile%20Pictures/nhayman_LThumb.jpg').then(function (response) {
return response.body;
});
/_api/Web/GetFileByServerRelativeUrl(@FileServerRelativeUrl)/$value
sp-request
lib and return the raw image data?http://mysites/_api/web/GetFolderByServerRelativeUrl('/User%20Photos/Profile%20Pictures')/Files('nhayman_LThumb.jpg')/$value
const spr = sprequest.create(credentialOptions);
spr.get(fileUrl).then(function (response) {
return response.body; // I'm not writing the file to disk because I need to send it to another API
});
HTTP_PROXY=http://my-proxy HTTPS_PROXY=http://my-proxy node ./index.js
. As you're talking about VSCode extension you can try setting up these environment variables, not for a console process but OS user.
@hanadkubat, thanks for starting using the generator. Yes, we still have 2013 projects.
when I publish my work to Sharepoint and open the html document directly
Didn't get this. After assets are published, html should be added to CEWP as a source link. For SPA, it can be web parts page with a single content editor web part. Pages+CEWP can be provisioned with PnP Provisioning Engine or SPMeta2 in automated way, or configured manually.
npm run publish
task publishes assets from local ./dist
folder to spFolder
(defined in ./config/app.json
). If you really need to change the publishing path destination from _catalogs/masterpage
to something else, e.g. SiteAssets
or Style Library
it can be done by editing ./config/app.json/spFolder
, but I recommend the defaults. When running publish task all the files from the dist folder are uploaded with spsave to SharePoint (2013 is supported as well). Then you link assets in CEWP or script link user custom action, etc.