ILinkDescriptorCmd::Initialize

The Initialize method initializes the LinkDescriptor component for use by the Add or AddViaTemplate command, by specifying the object store item to be linked, the link class to use when creating the linked object, and the relationship between the two linked objects (that is, which link is the head and which is the tail).

void spILinkDescriptor->Initialize(IObjectStoreItemPtr pIObjectStoreItem,
                                   _bstr_t bstrLinkClassID,
                                   RelationshipType enLinkType,
                                   _bstr_t bstrPropertiesXml);
Parameters
pIObjectStoreItem - [in] Required pointer to an IObjectStoreItem interface, in which the version series ID (GUID) for the reservation object for the object for the item to link, is specified in the bstrVersionID parameter.
bstrLinkClassID - [in] Required _bstr_t, which specifies the class ID to use when creating the linked object. The ID can be any constant specified in a subclass of the Link class, such as "Email Items" or "Related Items".
enLinkType - [in] Required member of the RelationshipType enumeration, that defines the relationship between the linked objects, which can be set to one of the following:


bstrPropertiesXml - [in] Required _bstr_t, which specifies the XML string that contains the properly formatted and XML encoded properties to be created in link object. When no properties should be created, a value of VT_EMPTY should be specified.
Results
This method always returns an HRESULT value of S_OK or E_INVALIDARG.
Sample
The following is a fragment from the complete example for the Add command.
   ...
   // Initialize the LinkDescriptor component to hold the link
   std::cout << "Initializing LinkDescriptor component 1..." << std::endl;
   spILinkDescriptor0->Initialize(spIObjectStoreItem0, bstrLinkClassID, enLinkType, bstrPropertiesXml);
   if(spILinkDescriptor0) {
      saLinks.PutElement(&lCount, spILinkDescriptor0);
   }     
   ...