Microsoft KB Archive/258146

= How To Pin and Unpin Files in Visual SourceSafe from OLE Automation in Visual Basic =

Article ID: 258146

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual SourceSafe 5.0 Standard Edition
 * Microsoft Visual SourceSafe 6.0 Standard Edition

-



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

