Share via


IKnowledgeVersion Interface

The IKnowledgeVersion interface, defines the methods and properties of, and is implemented by, the KnowledgeVersion object.

The KnowledgeVersion object provides advanced document management functions, such as versioning, approval, and publishing tasks.

Extends

IDispatch interface

Methods

The following table shows the methods of the IKnowledgeVersion interface, the type of each property, and a brief description of each. All properties are read/write, except where noted.

Name Description
Approve Approves the document as the current default version.
Checkin Updates the object in the store with a new version.
Checkout Locks a specific version of the object.
Impersonate Impersonates a user for all operations.
LockDiscovery Not supported.
OperationsAllowed Gets the operations allowed.
Publish Submits the document for publication.
Reject Rejects the approval of the document.
UndoCheckout Releases the lock on a version of the object.
VersionHistory Gets the version history.
VersionStatus Gets the version status of a document.
Remarks

When developing a stand-alone application, a Web Part or an ASP-based application that uses the KnowledgeVersion object, the flags parameter of the methods of this object, except the Impersonate method, indicates whether to use ServerXMLHTTP or WININET to send the requests. Active Server Pages (ASP) applications and Web Parts on a computer running Microsoft SharePoint Portal Server must use ServerXMLHTTP. Using WININET might cause Internet Information Services (IIS) to become unresponsive.

Example

To see this object in a fuller context, see Document Management Object Model Sample.

The following example shows the version control process in detail:

    Dim oDoc As New PKMCDO.KnowledgeDocument
    Dim oStream As ADODB.Stream
    Dim oVer As New PKMCDO.KnowledgeVersion
    
    Set oStream = oDoc.OpenStream
    oStream.Type = adTypeBinary
    oStream.SetEOS
    oStream.LoadFromFile "c:\doc1.doc"
    oStream.Flush
    
    oDoc.ContentClass = "urn:content-classes:basedocument"
    oDoc.Title = "My first title"
    oDoc.DataSource.SaveTo "http://myserver/myworkspace/documents/doc1.doc", , , adCreateOverwrite
    
    oVer.Checkin oDoc
    oVer.Publish oDoc
    
    oVer.Impersonate "mydomain\approver", "approverpassword"
    oVer.Approve oDoc
    
    Dim objRS As ADODB.Recordset
    oVer.Impersonate "mydomain\author", "authorpassword"
    Set objRS = oVer.Checkout(oDoc)
    
    ' Since a different version has been created for the working copy,
    ' you can no longer use oDoc.DataSource.Save directly. You now have
    ' to bind to the working copy.
    Dim oField As ADODB.Field
    Set oField = objRS.Fields("DAV:href")
 
    ' Re-bind
    oDoc.DataSource.Open oField.Value, , adModeReadWrite
    oDoc.Title = "My second title"
    oDoc.DataSource.Save
    
    ' If you do not have the original recordset available then you can
    ' just query the document for its working copy
    Dim oDoc2 As New PKMCDO.KnowledgeDocument
    oDoc2.DataSource.Open "http://myserver/myworkspace/documents/doc1.doc"
    
    Dim sWorkingCopy As String
    sWorkingCopy = oDoc2.Property("urn:schemas-microsoft-com:publishing:WorkingCopy")
    oDoc2.DataSource.Open sWorkingCopy, , adModeReadWrite
    oDoc2.Title = "My third title"
    oDoc2.DataSource.Save
 
Requirements
  • Type Library
    Microsoft PKMCDO for Microsoft Web Storage System
  • Inproc Server
    %Program Files%\Common Files\PKMCDO.dll

Addressing by Using URLs

Binding to Items Stored in SharePoint Portal Server

SharePoint Portal Server Code Practices

Using the Document Management Object Model