{"id":13750422,"url":"https://github.com/estruyf/gulp-spsync-creds","last_synced_at":"2025-05-09T15:32:03.080Z","repository":{"id":57259031,"uuid":"60606077","full_name":"estruyf/gulp-spsync-creds","owner":"estruyf","description":"Gulp plugin for synchronizing local files with a SharePoint library via user credentials","archived":true,"fork":false,"pushed_at":"2018-04-05T20:06:37.000Z","size":144,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-01T06:36:28.142Z","etag":null,"topics":["gulp-plugin","sharepoint"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estruyf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-07T10:53:18.000Z","updated_at":"2024-12-20T13:35:38.000Z","dependencies_parsed_at":"2022-08-25T02:21:26.414Z","dependency_job_id":null,"html_url":"https://github.com/estruyf/gulp-spsync-creds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fgulp-spsync-creds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fgulp-spsync-creds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fgulp-spsync-creds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fgulp-spsync-creds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estruyf","download_url":"https://codeload.github.com/estruyf/gulp-spsync-creds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253275619,"owners_count":21882340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gulp-plugin","sharepoint"],"created_at":"2024-08-03T08:00:35.352Z","updated_at":"2025-05-09T15:32:02.745Z","avatar_url":"https://github.com/estruyf.png","language":"JavaScript","funding_links":[],"categories":["Tools"],"sub_categories":["Samples"],"readme":"# gulp-spsync-creds\n\u003e Gulp plugin for synchronizing local files with a SharePoint library\n\n[![NPM](https://nodei.co/npm/gulp-spsync-creds.png?compact=true)](https://nodei.co/npm/gulp-spsync-creds/)\n\nThis Gulp plugin is based on [gulp-spsync](https://github.com/wictorwilen/gulp-spsync) which has been created by Wictor Wilen. The difference with gulp-spsync is that this plugin makes use for client credentials (username and password) in order to upload and/or download files. This makes the plugin usable for both SharePoint Online and on-premises environments.\n\n## Installation\nRun the following command to install the gulp-spsync-creds plugin:\n\n```\n$ npm install gulp-spsync-creds\n```\n\n## Usage\n### Uploading files\nFor uploading files, you can add the following code to your `gulpfile.js`:\n\n```javascript\nvar gulp = require('gulp');\nvar spsync = require('gulp-spsync-creds').sync;\n\ngulp.src('./src/**/*')\n.pipe(spsync({\n    \"username\": \"\u003cusername\u003e\",\n    \"password\": \"\u003cpassword\u003e\",\n    \"site\": \"\u003csite-url\u003e\",\n}));\n```\n\n### Downloading files\nFor downloading files, you can add the following code to your `gulpfile.js`:\n\n```javascript\nvar gulp = require('gulp');\nvar spdwn = require('gulp-spsync-creds').download;\n\nspdwn({\n    \"site\": \"\u003csite-url\u003e\",\n    \"username\": \"\u003cusername\u003e\",\n    \"password\": \"\u003cpassword\u003e\",\n    \"startFolder\": \"\u003crelative-folder-location\u003e\"\n}).pipe(gulp.dest(\"src\"));\n```\n\n*Information: it currently retrieves all files of the given path and the ones of three folders deep.*\n\n## Options\nThe plugin has the following options that can be configured:\n\n### username\nType: `String`\nDefault: `null`\n\nSets the username to be used for the sync action.\n\n### password\nType: `String`\nDefault: `null`\n\nSets the password to be used for the sync action.\n\n### site\nType: `String`\nDefault: `\"\"`\n\nSets the site URL to where the files should be uploaded.\n\n### startFolder\nType: `String`\nDefault: `\"\"`\n\nChoose the name of the folder location it has to starts from. This is useful when you have a nested folder structure. Example: \nif your folder structure is like this `src/template1/_sp/_catalogs`, and you set the *startFolder* option to `_sp`, it will strip out all the folder names before including `_sp`. You end up with `_catalogs`.\n\n**Important**: this property can also be used to specify the location from where you want to download files.\n\n### libraryPath **New property - v2.3.0**\nType: `string`\nDefault: `\"\"`\n\nThe libraryPath property can be used if you want to define a default library path to where you want to upload your files.\n\nBy default the plugin uploads the files based on their file location (under your source folder).\n\n```\nsrc\n|_ _catalogs\n   |_ masterpage\n      |_ your-folder\n         |_ file1.html\n```\n\nSo in the above case, `file1.html` will be uploaded to the master page gallery (`_catalogs/masterpage`) in a `your-folder` folder.\n\nWhen you define the libaryPath to for example: `documents`. The plugin will upload the files to that specific document library with the folder structure. So in this case it will be `documents/_catalogs/masterpage/your-folder/file1.html`.\n\n### update_metadata\nType: `Boolean`\nDefault: `false`\n\nSpecify if you want to update the metadata of files you are uploading. If this is set to `true`, you will have to pass the file metadata via the `files_metadata` option.\n\n### files_metadata\nType: `Object`\nDefault: `[]`\n\nWith the files_metadata option you can specify the metadata of all the files you wish to upload. Example:\n\n```json\n\"fileMetadata\": [\n    {\n        \"name\": \"Item_Minimal.js\",\n        \"metadata\": {\n            \"__metadata\": {\n                \"type\": \"SP.Data.OData__x005f_catalogs_x002f_masterpageItem\"\n            },\n            \"Title\": \"Item Minimal Template (via GULP)\",\n            \"MasterPageDescription\": \"This is a display template added via gulp.\",\n            \"ManagedPropertyMapping\": \"'Path','Title':'Title'\",\n            \"ContentTypeId\": \"0x0101002039C03B61C64EC4A04F5361F38510660500A0383064C59087438E649B7323C95AF6\",\n            \"DisplayTemplateLevel\": \"Item\",\n            \"TemplateHidden\": false,\n            \"TargetControlType\": {\n                \"__metadata\": {\n                \"type\": \"Collection(Edm.String)\"\n                },\n                \"results\": [\n                \"SearchResults\",\n                \"Content Web Parts\"\n                ]\n            }\n        }\n    },\n    {\n        \"name\": \"Control_Minimal.js\",\n            \"metadata\": {\n            \"__metadata\": {\n                \"type\": \"SP.Data.OData__x005f_catalogs_x002f_masterpageItem\"\n            },\n            \"Title\": \"Control Minimal Template (via GULP)\",\n            \"MasterPageDescription\": \"This is a display template added via gulp.\",\n            \"ContentTypeId\": \"0x0101002039C03B61C64EC4A04F5361F38510660500A0383064C59087438E649B7323C95AF6\",\n            \"DisplayTemplateLevel\": \"Control\",\n            \"TemplateHidden\": false,\n            \"TargetControlType\": {\n                \"__metadata\": {\n                \"type\": \"Collection(Edm.String)\"\n                },\n                \"results\": [\n                \"SearchResults\",\n                \"Content Web Parts\"\n                ]\n            }\n        }\n    }\n]\n```\n\n### publish\nType: `Boolean`\nDefault: `false`\n\nWith this option you can specify if you want to publish files after they are uploaded.\n\n### cache\nType: `Boolean`\nDefault: `false`\n\nIf set to true the plugin caches library locations that already have been processed. Makes the watch tasks quicker.\n\n### associatedHtml *(only for download actions)*\nType: `Boolean`\nDefault: `true`\n\nWith this property you can specify if you want to download all files (by default set to `true`) from a folder. This will also download the files that are associated to an HTML template like a page layout, master page and display template. If you set this property to `false`, the plugin only downloads the HTML files and leaves the \".aspx\", \".master\" and \".js\" files in the folder.\n\n### verbose\nType: `Boolean`\nDefault: `false`\n\nIf you wish to see all the plugin logging you can set this to true.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festruyf%2Fgulp-spsync-creds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festruyf%2Fgulp-spsync-creds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festruyf%2Fgulp-spsync-creds/lists"}