IBackupRestore.Id property

Gets or sets an ID for the content component.

Namespace:  Microsoft.SharePoint.Administration.Backup
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Property Id As Guid
    Get
    Set
'Usage
Dim instance As IBackupRestore
Dim value As Guid

value = instance.Id

instance.Id = value
Guid Id { get; set; }

Property value

Type: System.Guid
A Guid that identifies the content component that is represented by the IBackupRestore object.

Remarks

If your class derives from SPPersistedObject, do not implement this member.

In most cases, you implement the Id property by creating a private field for the name value and implement the public property as a wrapper around the field. Consider having the get accessor create a value, if the property has not previously been set. See the example.

Examples

The following example code shows an implementation for the Id property that ensures that it will always return a valid Guid.

private Guid id;
public Guid Id
{
get 
    {
        if (id == Guid.Empty)
        {
            id = Guid.NewGuid;
        }
    return id;
    }
set {id = value;}
}
Private _id As Guid
Public Property Id() As Guid
Get
        If id = Guid.Empty Then
            id = Guid.NewGuid
        End If
    Return id
End Get
Set(ByVal value As Guid)
    id = value
End Set
End Property

See also

Reference

IBackupRestore interface

IBackupRestore members

Microsoft.SharePoint.Administration.Backup namespace