Visual Studio Developer Center > Visual Studio Forums > Visual Studio Source Control and SourceSafe > IVSSItem.Undocheckout(string filepath, int iflags) and file's readonly attribute
Ask a questionAsk a question
 

AnswerIVSSItem.Undocheckout(string filepath, int iflags) and file's readonly attribute

  • Wednesday, July 01, 2009 11:56 PMmsejder Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    I am trying to automate and use VSS functionality for an add-in I am currently developing. I use VS2005 and C#.NET as my IDE and programming language.

    After I retrieved the VSSItem from source safe I checkedout it. Then I tried to undocheckout this item. What happens is the following:

    Undocheckout worked (I run the Source Safe itsel and looked to see if it is undocheckoutted). However, the read-only attribute of the local file specified by VSSItem did not become read-only.

    I passed the value SSFlags.VSSFLAG_DELNOREPLACE to iFlags parameter of the VSSItem.Undocheckout method.

    Despite that, local file's read-only attribute did not become enabled after a call to undocheckout. However, I see that if from my C# add-in application I checkout a file and then use the VS IDE to undocheckout the file, the file's read-only
    attribute enable again.

    What I am doing wrong? Any help will be much appretiated.

    Thank you


Answers

  • Thursday, July 02, 2009 11:50 AMCristian_t Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code

    Hi,


    Try using the default flag, VSSFLAG_DELNO for the UndoCheckout operation. By using this flag the read-only attribute will be preserved and the local copy will not be deleted. Read the online docs, available here, for more information.

    vssItem.UndoCheckout(item.LocalSpec, (int)(VSSFlags.VSSFLAG_DELNO));
    




    Cristi


    Cristian Trifan - Software Developer

All Replies

  • Thursday, July 02, 2009 11:50 AMCristian_t Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code

    Hi,


    Try using the default flag, VSSFLAG_DELNO for the UndoCheckout operation. By using this flag the read-only attribute will be preserved and the local copy will not be deleted. Read the online docs, available here, for more information.

    vssItem.UndoCheckout(item.LocalSpec, (int)(VSSFlags.VSSFLAG_DELNO));
    




    Cristi


    Cristian Trifan - Software Developer