Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSFileVersionMBS class.

NSFileVersionMBS.Conflict as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether the version was created as a result of the discovery of a conflict between two writers of the versioned file.

When two or more versions of a file are written at the same time, perhaps because the file is saved in the cloud and one or more of the writers were offline when they were writing, the system attempts to resolve the conflict automatically. It does this by picking one of the file versions to be the current file and setting this property to true for the other file version that are in conflict.

NSFileVersionMBS.Constructor   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The private constructor.

NSFileVersionMBS.Discardable as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Whether the system is allowed to automatically delete the receiver's storage in the future, at an unpredictable time.

Setting this to true can fail so you must not depend on discarding for correct operation.

Once you have indicated that a version is discardable you cannot make it undiscardable again. Setting this to false causes an exception to be thrown.

You cannot make the versioned file itself discardable. Setting the value of this property always throws an exception when sent to the result of invoking currentVersionOfItemAtURL.

Versions can be discardable only on Mac OS X.
(Read and Write computed property)

NSFileVersionMBS.File as folderitem

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The location of the receiver's storage.

Or possibly nil if the receiver's storage has been deleted. The storage is read-only. The URL will have an arcane path. You must not derive user-presentable text from it.
If the URL does not represent a folderitem, this function gives nil.

NSFileVersionMBS.localizedName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The user-presentable name of the version, or possibly "" if the receiver's storage has been deleted.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("Notes.rtf")
dim n as NSFileVersionMBS = NSFileVersionMBS.currentVersionOfItemAtURL(f)
MsgBox n.localizedName

This will be different from the user-presentable name of the versioned file if, for example, the file has been renamed since the version was added.

NSFileVersionMBS.localizedNameOfSavingComputer as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The user-presentable name of the computer on which the version was saved, or possibly "" if the receiver's storage has been deleted, or "" if no computer name was recorded.

The computer name is guaranteed to have been recorded only if the version is a conflict version. This will be different from that computer's current name if the computer's name has been changed since the version was retrieved from that computer.

NSFileVersionMBS.modificationDate as date

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The modification date of the version, or possibly nil if the receiver's storage has been deleted.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("Notes.rtf")
dim n as NSFileVersionMBS = NSFileVersionMBS.currentVersionOfItemAtURL(f)

MsgBox n.modificationDate.SQLDateTime

NSFileVersionMBS.modificationDateTime as dateTime

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 20.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The modification date of the version, or possibly nil if the receiver's storage has been deleted.

NSFileVersionMBS.persistentIdentifier as Memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
The identifier for this version of the file. (read-only)
Example
// get a file version
dim f as FolderItem = SpecialFolder.Desktop.Child("Notes.rtf")
dim n as NSFileVersionMBS = NSFileVersionMBS.currentVersionOfItemAtURL(f)

// get persistent identifier
dim m as MemoryBlock = n.persistentIdentifier

// later find version again
dim x as NSFileVersionMBS = NSFileVersionMBS.versionOfItemAtURLforPersistentIdentifier(f, m)

// and show something
MsgBox x.localizedName

You can save the value of this property persistently and use it to recreate the version object later. When recreating the version object using the versionOfItemAtURLforPersistentIdentifier method, the version object returned is equivalent to the current object.

The plugin encodes the identifier for you into a memoryblock, so you can store it somewhere in your preferences.

NSFileVersionMBS.removeAndReturnError(byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Delete the receiver's storage, and return true if successful.

If not successful, return false after setting Error to an NSErrorMBS that encapsulates why not. Subsequent invocations of versionsOfItemAtURL won't include an NSFileVersion for a successfully removed version.

You cannot use this method to delete the versioned file itself. This method always throws an exception when sent to the result of invoking currentVersionOfItemAtURL. Use NSFileManagerMBS.removeItemAtURL for that instead.

When removing versions of a file you should do it as part of a coordinated write to the file. The advice about this for addVersionOfItemAtURL applies here too.

NSFileVersionMBS.replaceItemAtURL(file as folderitem, options as Integer, byref error as NSErrorMBS) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Convenience variant of replaceItemAtURL which takes a folderitem.

See also:

NSFileVersionMBS.replaceItemAtURL(url as string, options as Integer, byref error as NSErrorMBS) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
If the passed-in URL locates a file, replace the file with a file whose contents are taken from the version but whose display name is taken from the file.

If the passed-in URL does not locate a file then simply write one. If successful, return a URL that locates the resulting file; it may be different from the passed-in URL. The one exception to taking the display name from an existing file is if the version is of a different type than the overwritten file. In that case the file name extension will be taken from the version. (When file name extensions are being hidden in a user-friendly way this is not actually an exception.) If not successful, return false after setting *outError to an NSError that encapsulates why not.

When you use NSFileVersionReplacingByMoving you remove a version of the file, and should do it as part of a coordinated write to the file. The advice about this for addVersionOfItemAtURL applies here too. When you use it to promote a version to a separate file you actually write to two files, and should do it as part of a coordinated write to two files, using NSFileCoordinatorMBS.coordinateWritingItemAtURL, most likely using NSFileCoordinatorWritingForReplacing for the file you're promoting the version to.

See also:

NSFileVersionMBS.Resolved as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
If the version is a conflict version, whether the conflict has been resolved.

If the version is not a conflict version, simply true.

The operating system's reaction to your setting this to true is complicated and subject to change in future releases. One result however is that the version won't appear in arrays returned by unresolvedConflictVersionsOfItemAtURL anymore, unless setting fails.

Once you have indicated that a conflict has been resolved you cannot make it unresolved again. Setting this to false causes an exception to be thrown.
(Read and Write computed property)

NSFileVersionMBS.URL as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The location of the receiver's storage.

Or possibly "" if the receiver's storage has been deleted. The storage is read-only. The URL will have an arcane path. You must not derive user-presentable text from it.

The items on this page are in the following plugins: MBS MacCloud Plugin.


The biggest plugin in space...