KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q258146: HOWTO: Pin/Unpin files in SourceSafe from OLE Automation in VB

Article: Q258146
Product(s): Microsoft SourceSafe
Version(s): WINDOWS:5.0,6.0
Operating System(s): 
Keyword(s): kbAutomation kbSSafe500 kbSSafe600 kbDSupport kbGrpDSSSafe
Last Modified: 01-MAY-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual SourceSafe for Windows, versions 5.0, 6.0 
-------------------------------------------------------------------------------

SUMMARY
=======

The OLE Automation for Visual SourceSafe does not expose the pinning
functionality directly. This article provides two functions that you can use to
pin and unpin a file from a Microsoft Visual Basic program.

MORE INFORMATION
================

The following function pins a file:

  Sub PinFile(objItem As VSSItem, version As Variant)
      Dim objOldItem As VSSItem
      Dim objProject As VSSItem
      
      Set objOldItem = objItem.version(version)
      Set objProject = objItem.Parent
      
      objProject.Share objOldItem, "", 0
          
      Set objOldItem = Nothing
      Set objProject = Nothing
  End Sub

The following function unpins a file:

  Sub UnpinFile(objItem As VSSItem)
      Dim objOldItem As VSSItem
      Dim objProject As VSSItem
      Dim version As Variant
      
      version = 0
      Set objOldItem = objItem.version(version)
      Set objProject = objItem.Parent
      
      objProject.Share objOldItem, "", 0
      
      Set objOldItem = Nothing
      Set objProject = Nothing
      Set version = Nothing
  End Sub

REFERENCES
==========

Visual SourceSafe 6.0 Automation


Additional query words:

======================================================================
Keywords          : kbAutomation kbSSafe500 kbSSafe600 kbDSupport kbGrpDSSSafe 
Technology        : kbSSafeSearch kbAudDeveloper kbSSafe600 kbSSafe500
Version           : WINDOWS:5.0,6.0
Issue type        : kbhowto

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.