How To Pin and Unpin Files in SourceSafe from OLE Automation in Visual C++ (257989)



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 Q257989

SUMMARY

The OLE Automation for Visual SourceSafe does not directly expose the pinning functionality. You can use the functions in the "More Information" section of this article to pin and unpin a file from a Visual C++ program.

NOTE: This sample code assumes that you reference the Visual SourceSafe OLE Automation by using this code:
#import "path to ssapi.dll" no_namespace
				

MORE INFORMATION

This function pins a file:
int PinFile(IVSSItemPtr objItem, int version)
{
   // Pinning code
   IVSSItemPtr    objOldItem;
   IVSSItemPtr    objProject;
   CComVariant    varVer;

   varVer = version;

   objOldItem = objItem->GetVersion(varVer);
   objProject = objItem->GetParent();

   objProject->Share(objOldItem, "", 0);

   return 1;
}
				
This function unpins a file:
int UnpinFile(IVSSItemPtr objItem)
{
   // Unpinning code
   IVSSItemPtr    objOldItem;
   IVSSItemPtr    objProject;
   CComVariant    varVer = 0;

   objOldItem = objItem->GetVersion(varVer);
   objProject = objItem->GetParent();

   objProject->Share(objOldItem, "", 0);

   return 1;
}
				

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


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