Timer Jobs to Copy and Delete Files in a Farm
There is sometimes a need to copy files in a SharePoint farm on different locations, than what can be specified in wsp-packages. Usually the best way to do it farm-wide, is to use Features and timer jobs. Timer jobs can be specified so that they are executed on every single machine in a SharePoint farm. In SharePoint 2007 the most common need we have had, is the copying of .resx and .browser files to a web application’s App_GlobalResources and App_Browsers directories. For most of you this is fairly basic information, but there might be readers and new comers to whom this might be interesting.
On web application level Feature’s feature activation we use the generic copy timer task as the following:
{
var webApp = properties.Feature.Parent as SPWebApplication;
if (webApp == null) return;
var src = Path.Combine(properties.Definition.RootDirectory, "x.browser");
foreach (var settings in webApp.IisSettings)
{
var dst = Path.Combine(Path.Combine(
settings.Value.Path.FullName, "App_Browsers"), "x.browser");
var touch = Path.Combine(Path.Combine(
settings.Value.Path.FullName, "App_Browsers"), "compat.browser");
var job = new CopyTimerJob(
"Sininen Meteoriitti X Control Adapter Copy Timer Job",
webApp, null, SPJobLockType.None)
{
Schedule = new SPOneTimeSchedule(DateTime.Now)
};
job.Properties.Add("src", src);
job.Properties.Add("dst", dst);
job.Properties.Add("touch", touch);
job.Update();
}
}
The code that does the actual copying of the file is defined in generic copy timer job class:
{
// Constructors stripped off to save some space
public override void Execute(Guid targetInstanceId)
{
try
{
var src = Properties["src"] as string;
var dst = Properties["dst"] as string;
var touch = Properties["touch"] as string;
if (src == null || dst == null) return;
var directoryName = Path.GetDirectoryName(dst);
if (!Directory.Exists(directoryName)) return;
File.Copy(src, dst, true);
if (touch != null && File.Exists(touch))
{
File.SetLastWriteTime(touch, DateTime.Now);
}
}
finally
{
Delete();
}
}
}
For deletes (on Feature deactivation) we have a similar timer job:
{
try
{
var src = Properties["src"] as string;
var touch = Properties["touch"] as string;
if (src == null) return;
if (File.Exists(src)) File.Delete(src);
if (touch != null && File.Exists(touch))
{
File.SetLastWriteTime(touch, DateTime.Now);
}
}
finally
{
Delete();
}
}
Popularity: 6% [?]
[...] Timer Jobs to Copy and Delete Files in a Farm (SharePoint Blues)There is sometimes a need to copy files in a SharePoint farm on different locations, than what can be specified in wsp-packages. Usually the best way to do it farm-wide, is to use Features and timer jobs. Timer jobs can be specified so that they are executed on every single machine in a SharePoint farm. In SharePoint 2007 the most common need we have had, is the copying of .resx and .browser files to a web application’s App_GlobalResources and App_Browsers directories. For most of you this is fairly basic information, but there might be readers and new comers to whom this might be interesting. [...]
[...] job to copy the meteoriitti_error.browser in web application’s App_Browsers directory (see timer jobs). The timer job is used to handle farm deployment scenario where there are multiple web front ends. [...]
i am using http://sptimerjobadmin.codeplex.com/ and all I want to do is get my custom properties to show up in the config page.
What is the best way to create dynamic properties for SPTimerJobs?
regards,
Michael
My brother recommended I might like this blog. He was entirely right.
This post truly made my day. You can not imagine simply how much time
I had spent for this info! Thanks!
This site was… how do I say it? Relevant!! Finally I have found something that helped me.
Many thanks!
Great write-up, I am normal visitor of one¡¦s web site, maintain up the nice operate, and It’s going to be a regular visitor for a lengthy time.
Нeya i’m for the primary time here. I founԀ this board аndd
I tto find It really useful & it helρed me out a lot.
I hope to offer onee thingg back anԀ help others such aѕ you aided mе.
My web blog … webpage
I аll theе tme emailed this websitе post page to all mʏ friendѕ,
because if like to read it then my links will too.
My website – wyndham rewards
Hello to every one, it’s genuinely a nice for me
to visit this web site, it contains important Information.
Kemudian sehabis akunnya telah dibuat, seterusnya adalah lakuin deposit.
It appears that the airplane did not suffer an abrupt
structural failure or catastrophic bomb attack that caused an immediate crash, but no one can be certain what caused the
airplane to fly under control for hundreds of miles before it presumably plunged into
the sea. Beberapa hal yang wajib anda pahami ialah total taruhan yang anda bet, dan perkiraan soccer yang
anda punya.
Excellent goods from you, man. I’ve understand your
stuff previous to aand you’re just too wonderful.
I actually like what you have acquired here, certainly
like whyat you’re statinjg and the wway in which you say
it. You make it enjoyable and you still take care of to keep it wise.
I can’t wait to read far more from you. This is really a terrific website.
Very nice post. I just stumbled upon your weblog and wanted to say that
I have truly loved browsing your blog posts. In any case I will be subscribing in your feed and I hope you write once more very soon!
Hi to every body, it’s my first pay a quick visit of this web site;
this weblog carries amazing and really fine material
in support of visitors.
My relatives every time say that I am wasting my time here
at net, except I know I am getting know-how every day by reading
thes pleasant posts.
Feel freee too surf to my blog :: club penguin free membership
Younger Busty Perky Ebony Uncovered Sexy young ebony teen gf blowjob Perfect ebony novice gf exposed Younger Ebony Homemade Sextape Scorching Gentle Skinned Ebony Fucked Perfect Light Skinned Ebony Anal videos or photos are pretty delicate
area of interest. Plenty of folks like to watch
it, few of them are literally doing it. And we like to look at teen anal videos,
so check out our web page with plenty of ass pounding clips and pics.
coming back for extra, and with our regular members area updates and free Chubby ebony
lesbians licking each other If that’s the case she might be
unfit for the onerous tasks she must meet ifthe struggle for black freedom is to deliver us
out of our historical bondageinto a truly new and liberated condition. Real
Ghetto Emotive Ebony Gf Scorching Slutty Ebony Gf Cumshoted Ebony
Brilliants
This website wɑs… how ɗo I ѕay it? Relevant!! Finally I’ve fօund ѕomething that helped
me. Тhank you!
Alsߋ visit mү homepage – buy instagram followers – Elijah -
Excellent blog post. I definitely appreciate this site.
Keep writing!
It’s going to be end of mine day, but before finish I am reading this impressive paragraph
to increase my know-how.
Hi there to all, the contents existing at this website
are in fact remarkable for people experience, well,
keep up the nice work fellows.
Seznamka vám ve dne і v noci nabízí na naší platformě možnost zapojit
se Ԁo erotickéɦо chatu s registrovanými členy, nebo ѕi rovnou domluvit schůzku.
Promente svoje nejtajnejší erotické fantazie а
sny vve skutecnost s nekým neokoukaným а neznámým a odvažte se.
Vyzkoušejte tߋ sami na vlastní kůži a užijte ѕi sex
v Plzni.
You will get the tաenty siх Jaam tracks tɦat teach simple chord progressions ɑnd the computeг software tɦat will assist you
tune уօur guitar.
Feel free tߋ surf tο mʏ web blog – best way to learn guitar scales free
With Media Challenge Productions all their clients
get benefit from a toolkit of skills, experience and technology.
If you use corporate videos or promotional videos as the tool
then, this would enhance your business and would give you a competitive edge.
It is important to let potential users what the benefits of
using these products are.
http://www.raybanssunglasses.cc,http://www.cheapoakleyssunglasses.cc,http://www.burberryitalia.in,http://www.gucci.in.net,http://www.cheap-airjordans.cc,http://www.michaelkorssverige.cc,http://www.rayban-baratas.es,http://www.timberlandskor.cc,http://www.ray-bans.cc,http://www.tomsoutlet.cc,http://www.nikeskorsverige.cc,http://www.woolrich.in.net,http://www.calvin-klein.com.es,http://www.converseshoes.cc,http://www.cheaptimberland.cc,http://www.air-jordan.cc,http://www.christianlouboutin.cc,http://www.scarpeonline.in.net,http://www.fendiborse.in.net,http://www.cheapmichaelkorshandbags.cc,http://www.cheaptoms.cc,http://www.airjordansshoes.us,http://www.hogan.in.net,http://www.nike-airmax.us,http://www.timberlandoutlet.cc
I do not even know how I finished up right here, however I believed this post was
good. I do not recognize who you might be however definitely you are going to a well-known blogger when you are
not already. Cheers!
‘ That movie is about the way we handle stress in our society and that’s another important topic.
- Put one in your bedroom and watch TV with Bluetooth Headphones
while your significant other sleeps peacefully, no fighting.
The film industry has seen big changes from digital distribution, marketing and even fundraising.
This is because the bad credit loan company’s promotions such loans will not verify the borrower’s
credit rating. Eliminating all of the red-tape is a method for
lenders to produce their customers ignorant to the fact that they’re
putting themselves in a poor spot, from a financial viewpoint.
There are numerous benefits to bad credit lenders that you probably aren’t alert to basically.
These kinds of Search marketing boxes normally realistic, healthy and balanced as a result receive just about every customer service necessary for some product. Link Building Services
Usually granted for a brief periods of time, they
allow you to catch-up on past due obligations until the next paycheck
is due. sales@auric79.com
I live in Allentown. I am taking admission in The Superior Academy of Hurt Children built at Clearwater. I am working as Writer. I am a fan of Jigsaw Puzzles.
This is a good common sense article. Very helpful to one who is just finding the resouces about this part. It will certainly help educate us – Sex in Lüneburg