Platforms to show: All Mac Windows Linux Cross-Platform

Back to CFBookmarkMBS module.

CFBookmarkMBS.Available as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether bookmark functions are available.

Returns true on Mac OS X 10.6 or newer.

CFBookmarkMBS.CreateBookmarkData(file as folderitem, options as UInt32 = 1024, relativeToURL as folderitem = nil) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a folderitem, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.
Example
dim file as FolderItem = SpecialFolder.Desktop.Child("test.rtf")
dim Bookmark as string = CFBookmarkMBS.CreateBookmarkData(file, CFBookmarkMBS.kCreationSuitableForBookmarkFile)

MsgBox str(lenb(Bookmark))+" bytes"

file: the folderitem to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

Some examples using this method:

CFBookmarkMBS.CreateBookmarkData(file as folderitem, options as UInt32, resourcePropertiesToInclude() as string, relativeToURL as folderitem = nil) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a folderitem, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.

file: the folderitem to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

CFBookmarkMBS.CreateBookmarkData(URL as CFURLMBS, options as UInt32 = 1024, relativeToURL as CFURLMBS = nil) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a URL, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.

URL: the URL to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

CFBookmarkMBS.CreateBookmarkData(URL as CFURLMBS, options as UInt32 = 1024, relativeToURL as folderitem = nil) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a URL, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.

URL: the URL to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

CFBookmarkMBS.CreateBookmarkData(URL as CFURLMBS, options as UInt32, resourcePropertiesToInclude() as string, relativeToURL as CFURLMBS = nil) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a URL, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.

URL: the URL to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

CFBookmarkMBS.CreateBookmarkData(URL as CFURLMBS, options as UInt32, resourcePropertiesToInclude() as string, relativeToURL as folderitem = nil) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a URL, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.

URL: the URL to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

CFBookmarkMBS.CreateBookmarkData(URL as string, options as UInt32 = 1024, relativeToURL as string = "") as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a URL, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.

URL: the URL to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

CFBookmarkMBS.CreateBookmarkData(URL as string, options as UInt32, resourcePropertiesToInclude() as string, relativeToURL as string = "") as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing an externalizable representation from a URL, modified with the given options, including ( at the minimum ) any properties in the propertiesToInclude array which are retrievable from the given url.

URL: the URL to create a bookmark data from.
options: a set of options which control creation of the bookmark data
resourcePropertiesToInclude: Optional, If non-empty, an array of additional properties copied from the url to include in the created bookmark data.
relativeToURL: If non-nil, the created bookmark will be relative to the given url

Lasterror is set.
Returns a string containing an data, which can be later be passed to ResolveBookmarkData.

See also:

CFBookmarkMBS.CreateBookmarkDataFromAliasRecord(AliasRecordData as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a string containing bookmarkdata by converting the alias data in aliasRecordData which should be the contents of an AliasRecord copied into a string.

The created bookmarkdata can be passed into ResolveBookmarkData to resolve the item into a folderitem or URL, or a small set of information can be returned from ResourcePropertiesForKeysFromBookmarkData / ResourcePropertyForKeyFromBookmarkData.
AliasRecordData: the contents of an AliasRecord to create bookmark data for

Returns a string containing bookmark data.

CFBookmarkMBS.LastError as CFErrorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
The last error.

This ia CFErrorMBS object.

CFBookmarkMBS.ReadBookmarkDataFromFile(file as folderitem) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a file which is a Finder "alias" file, return a string with the bookmark data from the file.

If file points to an alias file created before SnowLeopard which contains Alias Manager information and no bookmark data, then a bookmark data string will be synthesized which contains a approximation of the alias information in a format which can be used to resolve the bookmark. If an error prevents reading the data or if it is corrupt, nil will be returned and lasterror will be filled in if error object.

File: a folderitem to to the alias file to create the bookmark data from.

Returns a string containing bookmark data, or nil if there was an error creating bookmark data from the file, such as if the file is not an alias file.

CFBookmarkMBS.ResolveBookmarkData(bookmark as string, options as UInt32, relativeToURL as folderitem, byref isStale as boolean) as folderitem

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a folderitem of the item it was a bookmark to.
Example
dim AliasFile as FolderItem = SpecialFolder.Desktop.trueChild("test.alias")
dim Bookmark as string = CFBookmarkMBS.ReadBookmarkDataFromFile(AliasFile)
dim isStale as Boolean
dim options as UInt32 = CFBookmarkMBS.kResolutionWithoutUIMask + CFBookmarkMBS.kResolutionWithoutMountingMask
dim file as FolderItem = CFBookmarkMBS.ResolveBookmarkData(Bookmark, options, nil, isStale)

if file<>Nil then
MsgBox file.NativePath
else
dim e as CFErrorMBS = CFBookmarkMBS.LastError
if e = nil then
MsgBox "Failed to resolve."
else
MsgBox e.Description
end if
end if

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a folderitem of a file which is the closest match to the file the bookmark data.

Raises an exception if bookmark is empty string.

See also:

CFBookmarkMBS.ResolveBookmarkData(bookmark as string, options as UInt32, relativeToURL as folderitem, resourcePropertiesToInclude() as string, byref isStale as boolean) as folderitem

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a folderitem of the item it was a bookmark to.

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a folderitem of a file which is the closest match to the file the bookmark data.

Raises an exception if bookmark is empty string.

See also:

CFBookmarkMBS.ResolveBookmarkData(bookmark as string, options as UInt32, relativeToURL as string, byref isStale as boolean) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a folderitem of the item it was a bookmark to.

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a folderitem of a file which is the closest match to the file the bookmark data.

Raises an exception if bookmark is empty string.

See also:

CFBookmarkMBS.ResolveBookmarkData(bookmark as string, options as UInt32, relativeToURL as string, resourcePropertiesToInclude() as string, byref isStale as boolean) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a folderitem of the item it was a bookmark to.

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a folderitem of a file which is the closest match to the file the bookmark data.

Raises an exception if bookmark is empty string.

See also:

CFBookmarkMBS.ResolveBookmarkDataToCFURLMBS(bookmark as string, options as UInt32, relativeToURL as CFURLMBS, byref isStale as boolean) as CFURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a CFURL of the item it was a bookmark to.

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a CFURLMBS of a file which is the closest match to the file the bookmark data.

See also:

Some examples using this method:

CFBookmarkMBS.ResolveBookmarkDataToCFURLMBS(bookmark as string, options as UInt32, relativeToURL as CFURLMBS, resourcePropertiesToInclude() as string, byref isStale as boolean) as CFURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a CFURL of the item it was a bookmark to.

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a CFURLMBS of a file which is the closest match to the file the bookmark data.

See also:

Some examples using this method:

CFBookmarkMBS.ResolveBookmarkDataToCFURLMBS(bookmark as string, options as UInt32, relativeToURL as folderitem, byref isStale as boolean) as CFURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a CFURL of the item it was a bookmark to.

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a CFURLMBS of a file which is the closest match to the file the bookmark data.

See also:

Some examples using this method:

CFBookmarkMBS.ResolveBookmarkDataToCFURLMBS(bookmark as string, options as UInt32, relativeToURL as folderitem, resourcePropertiesToInclude() as string, byref isStale as boolean) as CFURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark data string, returns a CFURL of the item it was a bookmark to.

If in the process of resolving the bookmark into the folderitemit points to this determines that some properties in the bookmark are out of date or not correct for the item it resolves to, set isStale to true, which the client may want to use to decide to make a new bookmark from the returned item and replace the saved bookmark it has. If the bookmarked item cannot be found, return nil. If an error ( other than "original item can not be found" ) occurs during the process, return nil and fill in lasterror property )

bookmark: a string containing a bookmark data, created with CreateBookmarkData
options: options which affect the resolution
relativeToURL: If non-nil, and if the bookmark was created relative to another file/folder, then resolve it relative to this file/folder.
resourcePropertiesToInclude: Optional, if non-empty, an array containing those properties which the caller would like to already be cached on the given url.
isStale: On exit will be set to true if during resolution any of the properties in the bookmark no longer seemed to match the corresponding properties on the returned file. Clients, upon seeing a stale representation, may want to replace whatever stored bookmark data they have saved and create a new one.

Lasterror is set.

Returns a CFURLMBS of a file which is the closest match to the file the bookmark data.

See also:

Some examples using this method:

CFBookmarkMBS.ResourcePropertiesForKeysFromBookmarkData(BookmarkData as string) as dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark, return a dictionary of all properties.
Example
dim f as FolderItem = SpecialFolder.Desktop.TrueChild("Webseiten")

dim data as string = CFBookmarkMBS.ReadBookmarkDataFromFile(f)

if data.lenb > 0 then
dim dic as Dictionary = CFBookmarkMBS.ResourcePropertiesForKeysFromBookmarkData(data)

Break // see in debugger
end if

This returns only the properties stored within the bookmark and will not attempt to resolve the bookmark or do i/o.

BookmarkData: a string containing a bookmark data, created with CreateBookmarkData

Returns a dictionary containing the values for all properties passed in obtained from the bookmark data ( not by attempting to resolve it or do i/o in any way )

Version 17.1 of our plugin knows a list of keys, so it tries all keys and returns the dictionary with matching ones.

See also:

CFBookmarkMBS.ResourcePropertiesForKeysFromBookmarkData(BookmarkData as string, resourcePropertiesToReturn() as string) as dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark, return a dictionary of properties.

This returns only the properties stored within the bookmark and will not attempt to resolve the bookmark or do i/o.

BookmarkData: a string containing a bookmark data, created with CreateBookmarkData
resourcePropertiesToReturn: Optional an array of string of the properties of the bookmark data which the client would like returned.

Returns a dictionary containing the values for the properties passed in obtained from the bookmark data ( not by attempting to resolve it or do i/o in any way )

See also:

CFBookmarkMBS.ResourcePropertyForKeyFromBookmarkData(BookmarkData as string, resourcePropertyKey as string) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a bookmark, return the value for a given property from the bookmark data.

This returns only the properties stored within the bookmark and will not attempt to resolve the bookmark or do i/o.
BookmarkData: a string containing a bookmark data, created with CreateBookmarkData
resourcePropertyKey: the property key to return.

Returns a variant value for the property passed in obtained from the bookmark data ( not by attempting to resolve it or do i/o in any way )

CFBookmarkMBS.StartAccessingSecurityScopedResource(URL as CFURLMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a file URL created by resolving a bookmark data created with security scope, make the resource referenced by the url accessible to the process.

When access to this resource is no longer needed the client should call StopAccessingSecurityScopedResource(). Each call to StartAccessingSecurityScopedResource() must be balanced with a call to StopAccessingSecurityScopedResource().
URL: the file URL for the resource returned by CreateByResolvingBookmarkData() using kResolutionWithSecurityScope.

Returns true if access was granted and false if the url does not reference a security scoped resource, or if some error occurred which didn't allow access to be granted.
Available on Mac OS X 10.7 or newer.

CFBookmarkMBS.StopAccessingSecurityScopedResource(URL as CFURLMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Revokes the access granted to the url by a prior successful call toStartAccessingSecurityScopedResource().

Available on Mac OS X 10.7 or newer.

CFBookmarkMBS.WriteBookmarkDataToFile(BookmarkData as string, file as folderitem, options as UInt32) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Alias MBS MacCF Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Given a created bookmarkData object, create a new Finder "alias" file at file which contains the bookmark data.
Example
dim file as FolderItem = SpecialFolder.Desktop.TrueChild("test.rtf")
dim Bookmark as string = CFBookmarkMBS.CreateBookmarkData(file, CFBookmarkMBS.kCreationSuitableForBookmarkFile)

dim AliasFile as FolderItem = SpecialFolder.Desktop.TrueChild("test.alias")
if CFBookmarkMBS.WriteBookmarkDataToFile(Bookmark, AliasFile, 0) then
MsgBox "OK"
else
dim e as CFErrorMBS = CFBookmarkMBS.lasterror
MsgBox "Failed: "+e.Description
end if

If file points to a directory, an alias file will be created with the same name as the bookmarked item and a ".alias" extension. If file points to a file and it exists it will be overwritten. If a .alias extension is not present it will be added. In addition to the bookmark data, sufficient pre-SnowLeopard alias data will added to the file to allow systems running something before SnowLeopard to resolve this file using Alias Manager routines and get back the same file as the bookmark routines.

The bookmark data must have been created with the kCFURLBookmarkCreationSuitableForBookmarkFile option and an error will be returned if not.

bookmark: A string containing a bookmark data, created with CreateBookmarkData
file: The file/folder to write the alias to.
options: options flags

Lasterror is set.

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


The biggest plugin in space...