Jaa


CReplicationItem.Attributes Property

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Gets the file attribute settings that are assigned to an item, a file, or an Internet Information Services (IIS) metabase item.

object Attributes { get; }

Return Value

A read-only bit field where the bits have the meanings defined in the following table.

Attribute name

Bit

Description

FILE_ATTRIBUTE_READONLY

1

(0x1)

The item is read-only.

FILE_ATTRIBUTE_HIDDEN

2

(0x2)

The item is hidden.

FILE_ATTRIBUTE_SYSTEM

4

(0x4)

The item is a system item.

FILE_ATTRIBUTE_DIRECTORY

16

(0x10)

The item is an IIS metabase directory.

FILE_ATTRIBUTE_ARCHIVE

32

(0x20)

The item has the archive bit set.

FILE_ATTRIBUTE_ENCRYPTED

64

(0x40)

The item is encrypted.

FILE_ATTRIBUTE_NORMAL

128

(0x80)

The item is a typical file or directory.

FILE_ATTRIBUTE_TEMPORARY

256

(0x100)

The item is a temporary directory.

FILE_ATTRIBUTE_SPARSE_FILE

512

(0x200)

The item is a sparse file.

FILE_ATTRIBUTE_REPARSE_POINT

1024

(0x400)

The item is a reparse point.

FILE_ATTRIBUTE_COMPRESSED

2048

(0x800)

The item is a compressed file or directory.

FILE_ATTRIBUTE_OFFLINE

4096

(0x1000)

The item is not available.

Remarks

The attributes are defined in the WinNT.h header file.

The CReplicationItem object can be a file or an IIS metabase item. If the FILE_ATTRIBUTE_DIRECTORY attribute is not set, the CReplicationItem object is a file. If the CReplicationItem object is a file, the Attributes property contains the file attributes. If the FILE_ATTRIBUTE_DIRECTORY attribute is set, CReplicationItem is an IIS metabase item.

The CReplicationItem.Attributes property corresponds to the COM property named ReplicationItem.Attributes.

Example

The following example displays the attributes and all the other properties of a CReplicationItem object for the replication items that are in the \LocalProj directory for the project named Test.

CReplicationServer replicationServer = new CReplicationServer();
replicationServer.Initialize("");
CReplicationProject replicationProject = (CReplicationProject)replicationServer.OpenProject("Test", CSS_PROJECT_CREATION.OPEN_EXISTING_PROJECT);

CReplicationItem item;
int iterator = 0;
object i = iterator as object;

while (true)
{
    try
    {
        // Get the next replication item
        item = (CReplicationItem)replicationProject.EnumItems(@"\LocalProj", ref i);
        Console.WriteLine("Name: {0}",item.Name);
        Console.WriteLine("Attributes: {0}", item.Attributes);
        Console.WriteLine("Creation time: {0}", item.CreationTime);
        Console.WriteLine("Last access time: {0}", item.LastAccessTime);
        Console.WriteLine("Last modified time: {0}", item.LastModifiedTime);
        uint size;
        size = Convert.ToUInt32(item.SizeLow) + (Convert.ToUInt32(item.SizeHigh) * Convert.ToUInt32(Math.Pow(2, 16)));
        Console.WriteLine("Size: {0} bytes. \n", size);
    }
    catch (System.Runtime.InteropServices.COMException e)
    {
            // Quit if "No more items" error
            if (e.ErrorCode == -2147422485)
                break;
            else
                throw e;
    }
}

See Also

Other Resources

CReplicationItem Class