PublishItem Method

Directs the publishing plug-in to publish a specified media object.

virtual bool PublishItem(
      System.Windows.Forms.IWin32Window parentWindow,
       string mediaItemId,
       System.IO.Stream stream,
       System.Xml.XmlDocument sessionXml,
      IPublishProperties publishProperties,
      IPublishProgressCallback callback,
       System.Threading.EventWaitHandle cancelEvent

Parameter Description


A handle to the parent window that will be used to display any UI to the user.


The ID of the media object to be published.


The contents of the media object to be published.


Session specific information for this publish session.


A reference to an IPublishProperties interface, which can be used to access a media object's metadata store.


A reference to an IPublishProgressCallback callback interface that can be used to communicate progress information to the user.


A handle to a thread synchronization event.

true if the specified media object was successfully published; otherwise, false.

The PublishItem method is called once for each media item that is to be published during a particular publishing session.

A return value of false will not abort a job that is publishing multiple media objects. However, if a publishing plug-in raises an unhandled exception, the hosting Windows Live application will abort the entire publishing session.

After a publishing job completes, the total number of successfully published items is displayed to the user; the number of successfully published items corresponds to the number of times the PublishItem method is called and returns true.

The mediaObjectId parameter corresponds to the id attribute of the Item element within the sessionXml parameter.

A plug-in that publishes items asynchronously can wait on cancelEvent to detect and react to user-initiated cancellation requests.

Assembly: Microsoft.WindowsLive.PublishPlugins.dll