Namespace: ITHit.WebDAV.Server
Task UpdatePropertiesAsync( IList<PropertyValue> setProps, IList<PropertyName> delProps, MultistatusException multistatus ) Task UpdatePropertiesAsync( IList<PropertyValue> setProps, IList<PropertyName> delProps, MultistatusException multistatus )
Exception | Condition |
---|---|
NeedPrivilegesException | The user doesn't have enough privileges. |
InsufficientStorageException | Quota limit is reached. |
LockedException | This item was locked and client did not provide lock token. |
MultistatusException |
The exception shall contain statuses for all properties that
failed to update.
Typical property error statuses:
|
DavException | In other cases. |
In your UpdatePropertiesAsync(IListPropertyValue, IListPropertyName, MultistatusException) implementation you will create, modify and delete item properties. Single property update request may invoke following methods of single item which update properties:
The standard requires that request which updates properties is atomic (PROPPATCH). If your storage supports transactions then atomicity requirement can be implemented by committing or rollbacking the transaction in BeforeResponseAsync.
The code below is part of 'WebDAVServer.FileSystemStorage.AspNet' C# & VB samples provided with the SDK.
public async Task UpdatePropertiesAsync(IList<PropertyValue> setProps, IList<PropertyName> delProps, MultistatusException multistatus) { await RequireHasTokenAsync(); List<PropertyValue> propertyValues = await GetPropertyValuesAsync(); foreach (PropertyValue propToSet in setProps) { // Microsoft Mini-redirector may update file creation date, modification date and access time passing properties: // <Win32CreationTime xmlns="urn:schemas-microsoft-com:">Thu, 28 Mar 2013 20:15:34 GMT</Win32CreationTime> // <Win32LastModifiedTime xmlns="urn:schemas-microsoft-com:">Thu, 28 Mar 2013 20:36:24 GMT</Win32LastModifiedTime> // <Win32LastAccessTime xmlns="urn:schemas-microsoft-com:">Thu, 28 Mar 2013 20:36:24 GMT</Win32LastAccessTime> // In this case update creation and modified date in your storage or do not save this properties at all, otherwise // Windows Explorer will display creation and modification date from this props and it will differ from the values // in the Created and Modified fields in your storage if (propToSet.QualifiedName.Namespace == "urn:schemas-microsoft-com:") { switch (propToSet.QualifiedName.Name) { case "Win32CreationTime": fileSystemInfo.CreationTimeUtc = DateTime.Parse(propToSet.Value, new System.Globalization.CultureInfo("en-US")).ToUniversalTime(); break; case "Win32LastModifiedTime": fileSystemInfo.LastWriteTimeUtc = DateTime.Parse(propToSet.Value, new System.Globalization.CultureInfo("en-US")).ToUniversalTime(); break; default: context.Logger.LogDebug(string.Format("Unspecified case: DavHierarchyItem.UpdateProperties {0} from {1} namesapce", propToSet.QualifiedName.Name, propToSet.QualifiedName.Namespace)); break; } } else { PropertyValue existingProp = propertyValues.FirstOrDefault(p => p.QualifiedName == propToSet.QualifiedName); if (existingProp != null) { existingProp.Value = propToSet.Value; } else { propertyValues.Add(propToSet); } } } propertyValues.RemoveAll(prop => delProps.Contains(prop.QualifiedName)); await fileSystemInfo.SetExtendedAttributeAsync(propertiesAttributeName, propertyValues); await context.socketService.NotifyUpdatedAsync(Path); }