IHierarchyItem.GetProperties Method 

IT Hit WebDAV for .NET

Gets values of all properties or selected properties for this item.

[Visual Basic]
Function GetProperties( _
   ByRef props As Property() _
) As WebDAVResponse
[C#]
WebDAVResponse GetProperties(
   ref Property[] props
);

Parameters

props
  1. Array of properties which values are requested. If a property does not exist for this hierarchy item then Value field in the array should not be modified.
  2. null to get all properties. New array must be created and returned through this parameter.

Return Value

Example

    public WebDAVResponse GetProperties(ref Property[] props)
    {
        SqlConnection conn = new SqlConnection(connStr);
        SqlCommand cmd;
        SqlDataReader reader = null;
        conn.Open();
           
        try
        {
            cmd = conn.CreateCommand();
            cmd.CommandText = "SELECT Name, Namespace, PropVal"
                +" FROM Properties"
                +" WHERE ItemID = @ItemID";
               
            cmd.Parameters.Add("@ItemID", SqlDbType.Int).Value = ID;
               
            reader = cmd.ExecuteReader();
            if(props == null) // get all properties
            {
                ArrayList l = new ArrayList();
                while(reader.Read())
                {
                    Property p = new Property();
                    p.Name = reader.GetString(reader.GetOrdinal("Name"));
                    p.Namespace = reader.GetString(reader.GetOrdinal("Namespace"));
                    p.Value = reader.GetString(reader.GetOrdinal("PropVal"));
                    l.Add(p);
                }
                props = (Property[])l.ToArray(typeof(Property));
            }
            else // get selected properties
            {
                Property p = new Property();
                while(reader.Read())
                {
                    p.Name = reader.GetString(reader.GetOrdinal("Name"));
                    p.Namespace = reader.GetString(reader.GetOrdinal("Namespace"));
                    for(int i=0; i<props.Length; i++)
                        if(p.Name == props[i].Name && p.Namespace == props[i].Namespace)
                        {
                            props[i].Value = reader.GetString(reader.GetOrdinal("PropVal"));
                            break;
                        }
                }
            }
        }
        finally
        {
            if(reader != null) reader.Close();
            conn.Close();
        }
        
        return new OkResponse();
    }

See Also

IHierarchyItem Interface | ITHit.WebDAV.Server Namespace