1

I am creating my master page using HTML. my html has a lot of files (css, img, js etc) these files needs to be published.

But I have 100+ files that needs to be published manually.

How can I make this a lot easier using powershell or anything?

  • Are you creating and deploying a SharePoint solution (WSP)? What's the hosting model? Is this a SharePoint app? Typically, creative assets are provisioned into SharePoint using a custom solution, but you can of course leverage the CSOM to upload and publish assets, too. – nsturdivant Sep 24 '14 at 1:37
  • @nsturdivant, no I am not deploying a sharepoint solution. I am creating my master page via the design manager of SharePoint 2013 (on premise) – Aventus Sep 24 '14 at 1:52
1

If it's on premise and you have access to a server in the farm (either an application server or a web front end) you can leverage the SharePoint 2013 Management Shell. RDP to the box, copy up the assets, and run the SharePoint 2013 Management Shell as an administrator. Use the SharePoint 2013 commandlets and the server-side object model to upload the files to the target document library(ies) and publish them. Here are a couple posts that discuss how to upload files in this way:

If you don't have access to a server in the farm or just want to save yourself the hassle of copying the assets up to the server, you can always upload the files remotely via the client-side object model (CSOM). Check out this TechNet blog post by Brendan Griffin. He describes how to do this using PowerShell.

Given the number of files you need to upload, you'll probably want to iterate over, say, all the files in a particular directory, uploading each file to a document library in your SharePoint site before publishing each file in turn. Publishing via CSOM will look something like this:

...
$item.File.Publish("") # publish without comments
$context.Load($item)
$context.ExecuteQuery()
...
  • Have you tried this in the _catalogs/masterpage? I tried the post/method you suggested in a document library but not for the _catalogs/masterpage path. – Aventus Sep 25 '14 at 1:36
0

Have you tried placing the files in Sharepoint Hive

Else you have to publish the files by writing the Console Application (or) PowerShell script.

Ref Here link for Approving using PowerShell

  • Putting files in the hive directly is a bad idea. Most likely as soon as you update, things will start breaking. – Nullldata Sep 19 '18 at 8:22
0

Not sure if it is what you need. But when I'm developing my master and other html templates in _catalogs/masterpage I also place assets there or in style library or site assets folders. And I simply disable everything in Document Library Versioning Settings so I don't need to publish everything or check it out to edit. It is possible to enable those setting later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.