Click or drag to resize

IHierarchyItemAsyncUpdatePropertiesAsync Method (Property, PropertyName)

IT Hit WebDAV Classes Reference
Updates values of properties exposed by this item.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 2.0.420.0
Syntax
Task UpdatePropertiesAsync(
	Property[] propertiesToAddOrUpdate,
	PropertyName[] propertiesToDelete
)

Parameters

propertiesToAddOrUpdate
Type: ITHit.WebDAV.ClientProperty
Properties to be updated.
propertiesToDelete
Type: ITHit.WebDAV.ClientPropertyName
Names of properties to be removed from this item.

Return Value

Type: Task

[Missing <returns> documentation for "M:ITHit.WebDAV.Client.IHierarchyItemAsync.UpdatePropertiesAsync(ITHit.WebDAV.Client.Property[],ITHit.WebDAV.Client.PropertyName[])"]

Exceptions
ExceptionCondition
LockedExceptionThe item is locked and no or invalid lock token was provided.
PropertyForbiddenExceptionCannot alter one of the properties.
PropertyConflictException The client has provided a value whose semantics are not appropriate for the property. This includes trying to set read-only properties.
NotFoundExceptionThis item doesn't exist on the server.
ConflictException The resource is version controlled and has to be checked out to be edited.
PropertyExceptionServer returned unknown error for specific property.
WebDavHttpExceptionServer returned unknown error.
WebDavExceptionUnexpected error occurred.
Examples
string license = "<?xml version='1.0' encoding='utf...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFileAsync file = await session.OpenFileAsync(new Uri("https://server/Library/doc.txt"));

Property[] propsToAddAndUpdate = new Property[3];
propsToAddAndUpdate[0] = new Property(new PropertyName("Ammount", "CorpNS"), "1200");
propsToAddAndUpdate[1] = new Property(new PropertyName("ManagerApproved", "Sales"), "Yes");
propsToAddAndUpdate[2] = new Property(new PropertyName("Branch", "Sales"), "EMEA Region");

PropertyName[] propsToDelete = new PropertyName[2];
propsToDelete[0] = new PropertyName("InternalName", "Sales");
propsToDelete[1] = new PropertyName("Counter", "CorpNS");

try
{
    await file.UpdatePropertiesAsync(propsToAddAndUpdate, propsToDelete);
}
catch(PropertyException ex)
{
    Console.WriteLine(ex.Message + " " + ex.Status.Code + " " + ex.Status.Description);
    // Find which properties failed to add/update/delete
    foreach (IPropertyMultistatusResponseAsync propInfo in ex.Multistatus.Responses)
    {
        Console.WriteLine(propInfo.PropertyName + " " + propInfo.Status.Code + " " + propInfo.Status.Description);
    }
}
See Also