I've already read the article
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnvss/html/vssauto.asp
and have the sample SS Explorer application.
Unfortuantely, the sample SS explorer lacks pin/unpin
functionality.
Can anyone help?
Cheers
Dave
HOWTO: Pin and Unpin Files in Visual SourceSafe from OLE Automation in
ID: 258146
http://support.microsoft.com/default.aspx?scid=kb;en-us;258146&Product=vss
HOWTO: Get a List of All Pinned Files from OLE Automation in Visual Basic
ID: 258144
http://support.microsoft.com/default.aspx?scid=kb;en-us;258144&Product=vss
HOWTO: Obtain a List of All Pinned Files from OLE Automation in Visual
WGID:149
ID: 257990
http://support.microsoft.com/default.aspx?scid=kb;en-us;257990&Product=vss
HOWTO: Pin and Unpin Files in SourceSafe from OLE Automation in Visual
WGID:149
ID: 257989
http://support.microsoft.com/default.aspx?scid=kb;en-us;257989&Product=vss
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com
Patrick McCormick
Developer Support Engineer, VSS
Microsoft Corporation
That's exactly what I was looking for.
Thanks
Dave
Sorry for the late reply. Check out this k-base article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;257989
Hope that helps,
Weston
"David Aughey" <vss.9....@spamgourmet.com> wrote in message
news:1d9201c38343$a4684450$a301...@phx.gbl...
I have read and used the following Microsoft KB articles
in my code thus far:
=====================
General Documentation
---------------------
http://msdn.microsoft.com/library/en-
us/dnvss/html/vssauto.asp
======================
Is a File Item Pinned?
----------------------
http://support.microsoft.com/default.aspx?scid=kb;en-
us;258144&Product=vss
===================
(Un)Pin a File Item
-------------------
http://support.microsoft.com/default.aspx?scid=kb;en-
us;258146&Product=vss
===================
I run into several problems:
First, the VSS API documentation for the VSSVersion
object lists valid values for the Action property, but
these values do not include the values being searched for
in the "is file pinned" example from KB 258144.
Second, the VSS API documentation for the VSSVersion
object lists the Action property as read-only. When I
use the API to pin a file, will the Action property "auto-
magically" know that the file is being pinned (and not
shared)? IS there something else I need to do to (re)set
the Action property?
Third, the first time I ran (stepped-through) my
application against a copy of our VSS database (which had
*only* ever been accessed through Visual SourceSafe 6), I
was finding VSSVersion.Action properties that started
with "Pinned" (see Console.WriteLine() in IsFilePinned()
below). As a result, the UnPinFile() function (see
below) was called and executed without any errors.
When I closed and re-opened the VSS client, all files
still showed as pinned. However, if I run my application
again, none of the VSSVersion.Action properties on *any*
of the files have the text "Pinned" or "Unpinned" in
them. As a test, I went back into the VSS client and
manually Unpined a file, exited and re-started VSS,
manually Pinned the file and exited VSS. I re-ran my
application and I still do not see any VSSVersion.Action
properties that contain the text "Pinned" or "Unpinned".
Given my experiences, I can not see how it is that the
example code provided in the above KB articles works
together to allow the identification and modification of
pins on VSS files. Can you help point me in another
direction?
Tony Selke
Tony_...@CompAid.com
====================
Below are my three relevant code functions (minus error
handling) based upon the examples provided in the above
knowledge base articles.
====================
Private Function IsFilePinned(ByRef vssFile As VSSItem)
As Boolean
Dim vssItemVersion As VSSVersion
For Each vssItemVersion In vssFile.Versions
If vssItemVersion.Action.ToUpper.StartsWith
("PINNED") Then
Return True
ElseIf vssItemVersion.Action.ToUpper.StartsWith
("UNPINNED") Then
Return False
End If
Console.WriteLine("v{0}: Action = '{1}'", _
vssItemVersion.VersionNumber.ToString, _
vssItemVersion.Action.ToString)
Next vssItemVersion
Return False
End Function
--------------------
Private Sub PinFile(ByRef vssFile As VSSItem)
Dim vssFileToPin As VSSItem = vssFile.Version
(vssFile.VersionNumber)
Dim vssProject As VSSItem = vssFile.Parent
vssProject.Share(vssFileToPin, "", 0)
End Sub
--------------------
Private Sub UnpinFile(ByRef vssFile As VSSItem)
Dim vssPinnedFile As VSSItem = vssFile.Version(0)
Dim vssProject As VSSItem = vssFile.Parent
vssProject.Share(vssPinnedFile, "", 0)
End Sub
====================