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?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
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 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
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.