IHierarchyItem.UpdateProperties Method 

IT Hit WebDAV for .NET

Modifies and removes properties for this item.

[Visual Basic]
Function UpdateProperties( _
   ByVal setProps As Property(), _
   ByVal delProps As Property() _
) As WebDAVResponse
[C#]
WebDAVResponse UpdateProperties(
   Property[] setProps,
   Property[] delProps
);

Parameters

setProps
Array of properties to be set.
delProps
Array of properties to be removed. Value field is ignored. Specifying the removal of a property that does not exist is not an error.

Return Value

In MultipropResponse each item could be:

Remarks

In your UpdateProperties implementation you will create, modify and delete item properties. If any property failed to update than you should not modify any properties and rollback the entire operation. To inform WebDAV client which properties failed to update you must return MultipropResponse class instance. Each item of MultipropResponse is the instance of PropResponse class and provides information about individual property update operation.

Example

        public WebDAVResponse UpdateProperties(Property[] setProps, Property[] delProps)
        {
            if(!ClientHasToken) // required by class 2 server only
                return new LockedResponse(); 
            
            MultipropResponse resp = new MultipropResponse();

            SqlConnection conn = new SqlConnection(connStr);
            SqlTransaction trans = null;
            try
            {
                conn.Open();
                trans = conn.BeginTransaction();

                if(setProps != null)
                    foreach(Property p in setProps)
                    {
                        SetProperty(p, trans); // create or update property
                        resp.AddResponses(new PropResponse(p, new OkResponse()));
                    }
                
                if(delProps != null)
                    foreach(Property p in delProps)
                    {
                        RemoveProperty(p.Name, p.Namespace, trans);
                        resp.AddResponses(new PropResponse(p, new OkResponse()));
                    }
                
                UpdateModified(trans);
                
                trans.Commit();
            }
            catch
            {
                if(trans != null) trans.Rollback();
                return new ServerErrorResponse();
            }
            finally
            {
                conn.Close();
            }
            
            return resp;
        }
 

See Also

IHierarchyItem Interface | ITHit.WebDAV.Server Namespace