Quick Tip: Adding Documents from Document Libraries to a Quick Deploy job

The content deployment jobs within SharePoint allow content from a source location to a distributed out to another location this could be another Site Collection\Web Application or even another farm. Jobs can be configured for paths, these jobs run at a specified time to deploy all the content to the site or just new and modified content, this is usually scheduled at a period of reduced activity on the site, such as at night, to limit resource utilisation. Additionally out of the box when a content deployment path is created a specific type of job is created called the Quick Deploy job, when configured this will run on a specified interval and allows for important content to be deployed outside of the normal schedule. The Quick Deploy job will look for documents that have been specified by a user within the UI and then deploy content the next time it runs. This allows for content that has been changed to be pushed to the destination site the next time the quick deploy runs.

A problem that has been encountered is that the UI only supports the deployment of Publishing Pages in the pages library. In a majority of cases this is probably what you want to achieve because this is where you would expect people to be modifying content such as a change to the corporate vision.

You can see an example of this feature in the below image


We have found that some of our customers are not using the publishing pages solely for adding this sort of priority message to their sites. Some customers want to use the quick deploy feature to deploy documents within document libraries for content such as urgent memos that need to be deployed immediately.

Within the standard UI this not supported however there is a Class Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob that allows you to add any content to the Quick Deploy Job.

With this in mind I created a feature that supports adding documents in a Document Library to the quick deployment through the UI. Below you can see a standard document that is in a site has the feature enabled. The Add to Quick Deploy will allow the document to be added to the next Quick Deploy run.


The below class provides the functionality to add the item to the Quick Deploy

public class QuickDelpoyTest
    public void QuickDeployment(string siteUrl, string webUrl, string itemUrl)
       //Add Deployment object

        using (SPWeb web = new SPSite(siteUrl).OpenWeb(webUrl))
            web.AllowUnsafeUpdates = true;
            ContentDeploymentJob.AddQuickDeployObject(web, Microsoft.SharePoint.Deployment.SPDeploymentObjectType.ListItem, itemUrl);
            web.AllowUnsafeUpdates = false;


The following code is from a code behind file that is linked to an ASPX page that call the above class

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        QuickDelpoyTest quickdep = new QuickDelpoyTest();

        string siteUrl = Request["SiteUrl"];
        string webUrl = SPContext.Current.Web.Url;
        string listUrl = Request["listUrl"];
        string itemUrl = Request["ItemUrl"];

        webUrl = webUrl.Remove(0, siteUrl.Length);

        quickdep.QuickDeployment(siteUrl, webUrl, itemUrl);

        Response.Redirect(siteUrl + webUrl + listUrl);

The elements file below calls the ASPX page with the appropriate variables and add the “Add to Quick Deploy” drop down menu

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="F7BBAD5F-7A57-4337-BBDB-BDFC85F5F51F"
                Title="Add to Quick Deploy">
    <UrlAction Url="/_layouts/QuickDeploy/quickdeploydoc.aspx?ItemUrl={ItemUrl}

There is currently an issue with passing the ListUrl however this only effect the post back to the site and not the functionality of the feature.

I hope you find this information useful and helps you if you deliver the required functionality.

This article was published by

Pete Mellish


Microsoft Consulting Services UK


Bio Page


Comments (5)

  1. Dan says:

    Hi Pete..my problem is a bit different than publishing pages..I want to publish IT outage notices. These would go to any combination of the 15 CIO’s we service here in the State…

    I have a site collection (for my service organization), then I have 15 subsites that we have relevent information for each agency (lead by a CIO).

    Current outage notices go out in email. I can only think of copying the notice across the relevant 15 sites affected by a notice (*groan*), or posting it at the collection in a outage doc lib and setting the CIO permissions for each notice (*ouch*)…

    any recommendations?

  2. Tom Puleo says:

    Can I download your feature? I’d like to try it out.

  3. Tom Puleo says:

    Hey, never mind. I built my own based on what you posted here, and a previous project I’d done. Thanks for putting this info up. It helped a lot.

  4. Rob says:

    Great article, I had this exact requirement so it saved me a ton of time. Just one thing, I think this line is leaking an SPSite object

    using (SPWeb web = new SPSite(siteUrl).OpenWeb(webUrl))



    I think it should be

    using (SPSite siteCollection = new SPSite("http://moss&quot;))


           using (SPWeb web = siteCollection.OpenWeb())




    explained here


Skip to main content