IVSSDatabase.ProjectRightsEnabled Property
Gets or sets a value indicating whether the project rights are enabled.
Namespace: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)
Syntax
'Declaration
Property ProjectRightsEnabled As Boolean
'Usage
Dim instance As IVSSDatabase
Dim value As Boolean
value = instance.ProjectRightsEnabled
instance.ProjectRightsEnabled = value
bool ProjectRightsEnabled { get; set; }
property bool ProjectRightsEnabled {
bool get ();
void set ([InAttribute] bool pEnabled);
}
/** @property */
boolean get_ProjectRightsEnabled ()
/** @property */
void set_ProjectRightsEnabled (/** @attribute InAttribute() */ boolean pEnabled)
function get ProjectRightsEnabled () : boolean
function set ProjectRightsEnabled (pEnabled : boolean)
Property Value
true if project rights are enabled; otherwise, false.
Remarks
[IDL]
HRESULT ProjectRightsEnabled([out, retval] boolean *pEnabled);
HRESULT ProjectRightsEnabled([in] boolean pEnabled);
The ProjectRightsEnabled property enables the project rights for all new SourceSafe. Only an Administrator can access this property; if another user attempts to access this property, a run-time error is generated.
Example
The following example demonstrates how to use the ProjectRightsEnabled property to enable project rights for a IVSSUser.
[C#]
using System;
using Microsoft.VisualStudio.SourceSafe.Interop;
public class IVSSTest
{
private static string GetUsername()
{
Console.Write("Enter Username: ");
return Console.ReadLine();
}
private static string GetPassword()
{
Console.Write("Enter Password: ");
return Console.ReadLine();
}
public static void Main()
{
// Create a VSSDatabase object.
IVSSDatabase vssDatabase = new VSSDatabase();
// Only SourceSafe Admin can access Project Rights.
vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini",
GetUsername(), GetPassword());
//Enable ALL DefaultProjectRights
vssDatabase.ProjectRightsEnabled = true;
vssDatabase.DefaultProjectRights = (int)VSSRights.VSSRIGHTS_ALL;
// Display DefaultProjectRights and ProjectRightsEnabled
string rightsOutput = "New User Rights: ";
switch(vssDatabase.DefaultProjectRights)
{
case 0:
rightsOutput += "No Rights";
break;
case (int)VSSRights.VSSRIGHTS_READ:
rightsOutput += "Read";
break;
case (int)VSSRights.VSSRIGHTS_READ +
(int)VSSRights.VSSRIGHTS_CHKUPD:
rightsOutput += "Read/Check Out/Check In";
break;
case (int)VSSRights.VSSRIGHTS_READ +
(int)VSSRights.VSSRIGHTS_CHKUPD +
(int)VSSRights.VSSRIGHTS_ADDRENREM:
rightsOutput += "Read/Check Out/Check In/Add/Rename/Delete";
break;
case (int)VSSRights.VSSRIGHTS_ALL:
rightsOutput += "Read/Check Out/Check" +
" In/Add/Rename/Delete/Destroy";
break;
default:
throw new Exception("Unknown VSS Database Right");
}
Console.WriteLine(rightsOutput);
Console.WriteLine("Project Rights Enabled: " +
vssDatabase.ProjectRightsEnabled);
}
}
Output:
New User Rights: Read/Check Out/Check In/Add/Rename/Delete/Destroy
Project Rights Enabled: True
See Also
Reference
IVSSDatabase Interface
IVSSDatabase Members
Microsoft.VisualStudio.SourceSafe.Interop Namespace
IVSSDatabase.DefaultProjectRights Property