How To Pin and Unpin Files in Visual SourceSafe from OLE Automation in Visual Basic (258146)



The information in this article applies to:

  • Microsoft Visual SourceSafe for Windows 5.0
  • Microsoft Visual SourceSafe for Windows 6.0

This article was previously published under Q258146

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

For additional information, visit the following Microsoft Web site: For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

257990 How To Obtain a List of All Pinned Files from OLE Automation in Visual C++


Modification Type:MinorLast Reviewed:7/1/2004
Keywords:kbAutomation kbhowto KB258146