mercredi 28 janvier 2015

Add file to layout folder on all frontend servers programmatically

I'd like to save a file programmatically to all SharePoint (front-end) servers in the current Farm.


Right now I'm doing the following:



string path = String.Join("\\", SPUtility.GetVersionedGenericSetupPath("TEMPLATE\\LAYOUTS\\STYLES\\Themable", 15), "AutoGeneratedThemedImageFile.css");
File.WriteAllText(path, "foo", Encoding.UTF8);


The problem is, that this will only write to the Server where the code is currently running (which makes sense I guess).


What is the correct way to do something like this? Should I create and deploy a solution programmatically? If so how? (Couldn't find anything useful when doing a quick googleing.) Or is there another, better way?


edit: Why I need this: I generate a CSS with themed images based on some settings a (farm) admin can configure on runtime. This CSS files needs then be placed in the themable folder in the 15-hive, so that it can/will be used when applying a new composed look.


Aucun commentaire:

Enregistrer un commentaire