Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSFileVersionMBS class.

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

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Add a new version of the file located by a URL, with the contents coming from a file located by either the same or a different URL, and return a new instance that represents the version if successful.

If not successful, return false after setting Error to an NSErrorMBS that encapsulates why not.

You can add versions only on Mac OS X.

When adding or removing versions of a file you should do it as part of a "coordinated" write to the file. see NSFileCoordinatorMBS class. Using it properly ensures that NSFilePresenters of the file, or directories that contain the file, receive accurate notifications about versions being added or removed. For example, use NSFileCoordinatorMBS.coordinateWritingItemAtURL when the file URL and the contents url are the same. (NSFileVersion doesn't simply use NSFileCoordinator itself because that would be insufficient when the adding or removing of versions is part of a larger operation that should be treated as one coordinated file access.)

NSFileVersionMBS.currentVersionOfItemAtURL(file as folderitem) as NSFileVersionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Convenience variant of currentVersionOfItemAtURL which takes folderitem.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("Notes.rtf")
dim n as NSFileVersionMBS = NSFileVersionMBS.currentVersionOfItemAtURL(f)

MsgBox n.localizedName

See also:

NSFileVersionMBS.currentVersionOfItemAtURL(url as string) as NSFileVersionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return an NSFileVersionMBS that represents the contents of the file located by a URL, or nil if there is no such file.

See also:

NSFileVersionMBS.FileURL(file as folderitem) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns URL for a folderitem.

Call is method in case you need to provide an URL for a folderitem.

NSFileVersionMBS.otherVersionsOfItemAtURL(file as folderitem) as NSFileVersionMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Convenience variant of otherVersionsOfItemAtURL taking a folderitem.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("Notes.rtf")
dim n() as NSFileVersionMBS = NSFileVersionMBS.otherVersionsOfItemAtURL(f)

// shows all time stamps of this file.
dim lines() as string
for each x as NSFileVersionMBS in n
lines.Append x.modificationDate.SQLDateTime
next
MsgBox Join(lines,EndOfLine)

See also:

NSFileVersionMBS.otherVersionsOfItemAtURL(url as string) as NSFileVersionMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return an array of NSFileVersionMBS objects associated with the file located by a URL, or an empty array if there is no such file.

The array never contains an NSFileVersionMBS equal to what currentVersionOfItemAtURL would return.

See also:

NSFileVersionMBS.removeOtherVersionsOfItemAtURL(file as folderitem, byref error as NSErrorMBS) as boolean

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

See also:

NSFileVersionMBS.removeOtherVersionsOfItemAtURL(url as string, byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Delete all of the versions associated with the file located by a URL, except for the current one, and return true if successful.

If not successful, return false after setting error to an NSErrorMBS that encapsulates why not.

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.

See also:

NSFileVersionMBS.temporaryDirectoryURLForNewVersionOfItemAtURL(url as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Given a URL, create a new directory that is suitable for using as the container of a new temporary file that you will create and use with NSFileVersionAddingByMoving.

This is useful when you want to create a new version of a file out of something other than the file's current contents, for example, the contents in memory of a document that has not yet been saved to its file. You must remove this directory when you are done with it, using NSFileManagerMBS.removeItemAtURL for example.

NSFileVersionMBS.unresolvedConflictVersionsOfItemAtURL(file as folderitem) as NSFileVersionMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return an array of NSFileVersions that represent unresolved conflicts for the file located by a URL, or nil if there is no such file.

See also:

NSFileVersionMBS.unresolvedConflictVersionsOfItemAtURL(url as string) as NSFileVersionMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return an array of NSFileVersions that represent unresolved conflicts for the file located by a URL, or nil if there is no such file.

See also:

NSFileVersionMBS.versionOfItemAtURLforPersistentIdentifier(file as folderitem, PersistentIdentifier as Memoryblock) as NSFileVersionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the version of the file that has the specified persistent ID.

url: The URL of the file whose version you want.
persistentIdentifier: The persistent ID of the NSFileVersion object you want. The plugin decodes it for you from the memoryblock.

Returns the file version object with the specified ID or nil if no such version object exists.

See also:

NSFileVersionMBS.versionOfItemAtURLforPersistentIdentifier(URL as string, PersistentIdentifier as Memoryblock) as NSFileVersionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the version of the file that has the specified persistent ID.

url: The URL of the file whose version you want.
persistentIdentifier: The persistent ID of the NSFileVersion object you want. The plugin decodes it for you from the memoryblock.

Returns the file version object with the specified ID or nil if no such version object exists.

See also:

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


The biggest plugin in space...