UpdateItems

From HotDocs Wiki

(Redirected from UpdateItems Object)
Jump to: navigation, search

The UpdateItems object represents a collection of UpdateItem objects in a HotDocs update catalog file or RSS document.

Contents

General Information

ProgID: HDNET.UpdateItems.1
HDNET.UpdateItems (version-independent)
CLSID: {F9E19E28-6DC7-4584-A549-9905A3CAB4E8}

Members

Methods
Method.gifAdd(newItem) Adds a new UpdateItem to the collection.
newItem: An UpdateItem object that will be added to the collection of update items.
Method.gifInCollection(guid) Determines whether the specified update item (identified by its guid) is in the UpdateItems collection.
guid: A String value, which is a unique identifier for an update item. If this identifier matches one of the items already in the collection, this method returns true. Otherwise, it returns false.
Method.gifItem(index) Returns the specified UpdateItem in collection.
index: A long index to specify which item to return from the collection.
Method.gifMarshallObject() Causes the object to be marshalled and returns a string. [For internal HotDocs use only.]
Method.gifRemove(Item) Removes an UpdateItem from the collection.
Item: An UpdateItem to remove from the collection of update items.
Method.gifSortByPubDate() Sorts the collection of items in ascending order by publication date.
Method.gifUnMarshallObject(retVal) Unmarshalls the object. [For internal HotDocs use only.]
retVal: A string representing the object to unmarshall.

Example Code

Example of Listing Update Items in a HotDocs Update RSS Document (Visual C#)
//This example opens an existing RSS document and displays the date on which each
//update was published (in ascending order).

HDNETLib.UpdateDocumentClass rss = new HDNETLib.UpdateDocumentClass();

//Open the existing RSS document rss.Parse("C:\\example.rss");

//Display information about the RSS feed System.Console.WriteLine("There are {0} update items in this feed, published on the following dates:",rss.channels.Item(0).items.Count.ToString()); rss.channels.Item(0).items.SortByPubDate(); for (int i = 0; i< rss.channels.Item(0).items.Count;i++) { System.Console.WriteLine("{0}: {1}",rss.channels.Item(0).items.Item(i).title,rss.channels.Item(0).items.Item(i).pubDate); }
Example of Adding a New Update Item to a HotDocs Update RSS Document (Visual C#)
//This example opens an existing RSS document and adds a new update
//item if its guid does not conflict with an existing update item.

HDNETLib.UpdateDocumentClass rss = new HDNETLib.UpdateDocumentClass(); HDNETLib.UpdateItemClass updateItem = new HDNETLib.UpdateItemClass();

//New Update Item updateItem = new HDNETLib.UpdateItemClass(); updateItem.required = true; updateItem.title = "Real Estate Addendum"; updateItem.link = "http://www.HobbleCreek.com/addendum.hdi"; updateItem.description = "This is a revised addendum for Real Estate contracts."; updateItem.guid = "00004"; updateItem.category = "File Update"; updateItem.pubDate = System.DateTime.Now;

//Open the existing RSS document rss.Parse("C:\\example.rss");

//Make sure the new item's GUID does not conflict with an existing item if (rss.channels.Item(0).items.InCollection(updateItem.guid)) { System.Console.WriteLine("Error! An item with the same GUID already exists in the RSS feed."); } else { rss.channels.Item(0).items.Add(updateItem); System.Console.WriteLine("The new update has been added to the RSS feed."); }

//Save the RSS document rss.Save("C:\\example.rss");