Properties Collection

SharePoint Designer Developer Reference

A collection of metadata as Property objects.

Remarks

Each item in the Properties collection represents an item associated with an individual Web, WebFile, or WebFolder object. For more information, see the table of PropertyKeys in the section below named "Using the PropertyKeys."

Choose a topic from the following list to go directly to that topic.

  • Using the Properties object
  • Using the Properties collection within a Web site
  • Using the property keys
Using the Properties object

Use the Add method to add a property to the Properties collection. The following statement adds a copyright statement to the Properties collection.

Visual Basic for Applications
ActiveWeb.Properties.Add "Copyright", _
    "Copyright 2006 by Coho Winery"

You can also add and remove categories and approval levels.

Use the ApplyChanges method to apply a Property object that has been added to the Properties collection. The following statements add and apply a copyright property to the Properties collection.

Visual Basic for Applications
ActiveWeb.Properties.Add "Copyright", _
    "Copyright 2006 by Coho Winery"
ActiveWeb.Properties.ApplyChanges

Use the Count property to return the total number of properties in the Properties collection. The following example verifies that the number of properties in the Properties collection has increased since the Copyright property was added and applied to the collection, and then adds the copyright to a Web site page.

Note

To run this example, you must have a Web site named "C:\My Documents\My Web Sites\Coho Winery" and a page in your Web named Zinfandel.htm. You may substitute an alternative Web site URL.

Visual Basic for Applications
Private Sub copyrightAdd()
    Dim myWeb As Web
    Dim myCopyright As String
    Dim myCount As Integer
    Dim myMessage As String
    myCopyright = "Copyright 2006 by Coho Winery"
    myCount = ActiveWeb.Properties.Count
    myMessage = "No new properties have been added."
    Set myWeb = Webs.Open("C:\My Documents\My Web Sites\Coho Winery")
    myWeb.Activate
    ActiveWeb.Properties.Add "Copyright", myCopyright
    If myCount <> ActiveWeb.Properties.Count – 1 Then
        MsgBox myMessage
        Exit Sub
    End If
    ActiveWeb.RootFolder.Files("Zinfandel.htm").Open
    ActiveDocument.body.insertAdjacentText "BeforeEnd", _
        ActiveWeb.Properties("Copyright")
    ActivePageWindow.Save
    ActiveWeb.Close
End Sub

Use the Delete method to delete a single property. The following statement deletes the Copyright property from the Properties collection.

Visual Basic for Applications
ActiveWeb.Properties.Delete("Copyright")

Use the Parent property when you want to return the container for the Properties collection. For example, the following statement returns the URL of the parent Web site.

Visual Basic for Applications
myParentURL  = ActiveWeb.Properties.Parent.Url
Using the Properties collection within a Web site

Use Properties(index), where index is the PropertyKey of the item in the Properties collection, to return a single property. The following example returns the value of the PropertyKey vti_hassearchbot.

Visual Basic for Applications
Private Sub CheckForSearchBot()
    Dim myProperties As Properties
    Dim myFoundSearchBot As Boolean
    Set myProperties = ActiveWeb.Properties
    With myProperties
        myFoundSearchBot =.Item("vti_hassearchbot")
    End With
End Sub

The values for properties are variant—that is, each value can be a string, a Boolean, or an array. You can use the Typename function to determine the type of the property value.

Note

To run the following example you must create a form that contains a text box named txtCategories. Also, notice that myCategories is declared as a variant type in this example. In the preceding example, myFoundSearchBot is declared Boolean but could also be declared as a string.

Visual Basic for Applications
Private Sub GetWebPropertyCategories()
    Dim myProperties As Properties
    Dim myCategories As Variant
    Dim myCategory As Variant
    Dim txtCategories As String
    Set myProperties = ActiveWeb.Properties
    With myProperties
        myCategories =.Item("vti_categories")
        For Each myCategory In myCategories
            txtCategories = txtCategories & "|" & myCategory
        Next
    End With
End Sub
Using the property keys

The property keys can be a valuable tool for organizing information about your Web sites. For example, you can add categories to the master list of categories on your Web site.

The category names can be added to the categories list with case sensitivity, but they will not appear with case sensitivity in the user interface (UI). Because of this, a situation may occur in which a user creates a category on the client, such as "Web Administrators", and a duplicate category exists on the server, such as "web administrators". In this case, Office SharePoint Designer assigns both categories to the "web administrators" category and neither category can be deleted from the Web site (in the UI). Programmatically, the case sensitivity will correctly display in the Immediate and Local windows of the Visual Basic Editor.

The following example adds a category to the properties for the active Web site, deletes the Waiting category from the same list (vti_categories), and then adds the new category to each of the files in the active Web site.

Note

When creating a new category, you must first add the new category to the Web site before you add it to any of the files. The procedure, AddCategories, adds a new category to the Web site and the next procedure, AddCategoryToFiles, adds the same category to all of the files in the Web site.

Visual Basic for Applications
Private Sub AddCategories()
    Dim myWeb As Web
    Dim myCategory(2) As String
    Dim myItem As Variant
    Set myWeb = ActiveWeb
    myCategory(0) = "+web administrators"
    myCategory(1) = "-waiting"
    ActiveWeb.Properties("vti_categories") = myCategory
    ActiveWeb.Properties.ApplyChanges
    'List all of the items in vti_categories in the Immediate window
    For Each myItem In myWeb.Properties("vti_categories")
        Debug.Print myItem
    Next
End Sub
Private Sub AddCategoryToFiles()
    Dim myWeb As Web
    Dim myCategories(1) As String
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myItem As Variant
    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files
    myCategories(0) = "+web administrators"
    For Each myFile In myFiles
        myFile.Properties("vti_categories") = myCategories
        myFile.Properties.ApplyChanges
        'List all the items in vti_categories in the Immediate window
        For Each myItem In myFile.Properties("vti_categories")
            Debug.Print myItem
        Next
    Next
End Sub

Note

Although you can create new categories, such as "web administrators", that aren't included in the categories that are automatically installed with Office SharePoint Designer, these new categories are not visible in the UI until they are added to the Web site. Notice that in the previous example, the new category was added to the Web site first and is visible in the UI.

The following table provides detailed information about the property keys available in Office SharePoint Designer. Notice that the names of all property keys in Office SharePoint Designer begin with "vti_". We suggest that you prefix the property keys you want to add with a short name, such as an abbreviation for the name of your company, to reduce the chances of naming conflicts with other properties.

Property Key Description Permission
vti_approvallevel The approval level set for a page. The available levels are AssignedTo, ReviewStatus, and Categories. Read/write
vti_approvallevels List of available approval levels that can be applied to documents in a Web site. This property key is a string vector (or an array of strings). Used to populate the Web-wide list of known "review statuses" (also known as "approval levels") that are set for a document. The approval levels you can set are AssignedTo, ReviewStatus, and Categories. Read-only
vti_approvedby The authenticated name of the person who approved the page. Read-only
vti_assignedby The authenticated name of the person who assigned the page to a user. Read-only
vti_assigneddate The date that the page was last assigned to a user. Read-only
vti_assignedto The authenticated name of the person to whom the page is assigned. Read-only
vti_author The author's name in string format. The identification of the authenticated author who has, or is, making changes to the document.
  Note
This property key differs from the Author property stored as part of Microsoft Office document properties, which can be set by the user to any arbitrary value.
Read-only
vti_casesensitiveurls True if the Web site is running on a server where URLs are case sensitive, such as a server running UNIX. For example, if this property is set to True, a file named MyFile.htm and a file named myFile.htm are treated as two separate files. Read-only
vti_categories The master list of categories. This property key is a string vector (or an array of strings) that is used for both Web-level and document-level metadata. At the Web-site level, the property key contains a list of all known categories that exist in the Web site. At the document level, it contains a list of all the categories to which the specified document belongs.

Note

These categories are automatically updated whenever a category is added or modified in any way.

Read/write
vti_clientvercutoff Sets a version cutoff string. This is most commonly used in a multiversion environment to prevent older versions of the application from running on a specific server. Read/write
vti_dataconns List of data connections used by database features in Office SharePoint Designer. Read-only
vti_defaultcharset The default character set for the Web site or page. Read-only
vti_defaultlanguage The default language for the Web site or page. Read-only
vti_description Provides a multiline text box in which the user can write comments. Read/write
vti_donotpublish True if the page is marked as "draft" or "not to be published." Read/write
vti_filesize The size of the file in bytes. Read-only
vti_generator This property key corresponds to the generator tag within an HTML document. The value of the vti_generator property key contains the name of the application that "generated" the document, which may be different from the application that was invoked to handle the page. For example, if you create or edit a page with Microsoft Word and then retrieve the value of the vti_generator property key in Office SharePoint Designer Visual Basic for Applications for that document, the value of the vti_generator property key is "Microsoft Word"—even though the procedure call was generated by Office SharePoint Designer. Valid values are "Microsoft Word", "Microsoft Access", "Microsoft Excel", and so on.

Note

Office SharePoint Designer defers to Word when a theme conflict exists if the vti_generator property key contains "Microsoft Word".

Read-only
vti_globalpage Marks a page as global; that is, a top-level page in the navigation structure, on the same level as, but not equal to, the home page. Read/write
vti_hasframeset True if the page contains framesets. This property key is used when constructing link bar links. When the page that is being linked is a frameset, the target attribute of the link is forced to "_top". This causes the new page to replace the current frameset to prevent recursive framesets at browse time. Read-only
vti_hasruntimebots True if the page has run-time bots on it. Read-only
vti_htmlextensions A concatenated string of extensions used to specify a Web file, such as htm.html.asp. Read-only
vti_httpdversion The version of Office SharePoint Designer that is running on the httpd server. Read-only
vti_imagemapformat Sets the URL format used by the server-side image map processor. Valid values are NCSA and CERN. This property key is useful only for Microsoft FrontPage. Office SharePoint Designer uses client-side image maps. Read/write
vti_imagemapurlprefix Sets the server-relative URL of the server-side image-map processor for the selected image-map format. If the value of the vti_imagemapurlprefix property key is set to an empty string (""), server-side image maps are handled automatically by the FrontPage Server Extensions. For other formats, provide the name and location of the image-map processor. To specify client-side image maps, set this variable to an empty string. Read/write
vti_insecureserverurl The http:// URL (unsecured URL) for a Web site. Provides compatibility with older browsers that may not have secure browsing capability. Read-only
vti_isbrowsable True if the page folder is browsable. Use Folder.IsBrowsable to set this value. Read-only
vti_ischildweb True if the specified folder is the root of a subsite. Use Folder.MakeWeb and Folder.RemoveWeb to modify. Read-only
vti_isexecutable True to enable if this folder is marked for executable content on the server. Use Folder.IsExecutable to set this value. Read/write
vti_isscriptable True if scripting is enabled for this folder. Use Folder.IsScriptable to set this value. Read-write
vti_longfilenames True if the server supports file names that are longer than the standard 8.3 file format. (The 8.3 file format supports only file names that have a maximum of eight characters and extensions that have a maxium of three characters, such as "filename.txt".) Read-only
vti_metatags Corresponds to the contents within the META tags in an HTML document. All of the information contained in this property key is added to the META tags collection. Read-only
vti_modifiedby Authenticated name of the author who last modified the page. Read-only
vti_navbuttonhomelabel The image file associated with the button that links to the home page.

Note

This image is retrieved from the theme associated with the file and is not customizable.

Read/write
vti_navbuttonhomelabeltext The text that overlays the vti_navbuttonhomelabel.

Note

This text is customizable by the user.

Read/write
vti_navbuttonlabeltext The text that overlays the vti_nvabuttonuplabel.

Note

This text is customizable by the user.

Read/write
vti_navbuttonnextlabel The image file associated with the button that links to the next page in the navigation structure.

Note

This image is retrieved from the theme associated with the file and is not customizable.

Read/write
vti_navbuttonnextlabeltext The text that overlays the vti_navbuttonnextlabel.

Note

This text is customizable by the user.

Read/write
vti_navbuttonprevlabel The image file associated with the button that links to the previous page in the navigation structure.

Note

This image is retrieved from the theme associated with the file and is not customizable.

Read/write
vti_navbuttonprevlabeltext The text that overlays the vti_navbuttonprevlabel.

Note

This text is customizable by the user.

Read/write
vti_navbuttonuplabel The image file associated with the button that links to the page one level up in the navigation structure.

Note

This image is retrieved from the theme associated with the file and is not customizable.

Read/write
vti_noclientimagemaps True if client image maps are prohibited. Read-only
vti_nonnavpage True if the page isn't associated with a navigation node within the navigation structure. Read/write
vti_nosourcecontrol True if the Web site is not stored under source control. Prevents adding a file to source control if this property is set to True.

Note

If a file has previously been added to a source control project with the vti_nosourcecontrol property set to False, and the property is subsequently set to True, the file will not be removed from the source control project.

Read/write
vti_originator Corresponds to the "originator" META tag in an HTML document. The value of this property key contains the name of the application that created the document. You should never overwrite this property key with the name of another application. The vti_generator property key should be used to track the application that last "generated" the HTML page. Simply editing a document in Office SharePoint Designer changes the value of the vti_generator property key to "Microsoft SharePoint Designer". Valid values are "Microsoft Word", "Microsoft Access", "Microsoft Excel", and so on.

Note

Office SharePoint Designer defers to Word when a theme conflict exists if the vti_generator property key contains "Microsoft Word".

Read-only
vti_privatetext The value of this property key must be an integer. Zero or not present is the default. A nonzero value means that the page is not added to any text indexes. This property key works only with the built-in text indexing in Office SharePoint Designer and is not recognized by Microsoft Internet Information Services (IIS). Read/write
vti_progid Corresponds to the "progid" META tag in an HTML document. The value of this property key determines which application opens the document when a user clicks (or double-clicks) the document's file name in Windows Explorer. Valid values are "FrontPage.Editor.Document", "Word.Document", "Excel.Sheet", "PowerPoint.Slide", "Access.Application".

Note

Office SharePoint Designer defers to Word when a theme conflict exists if the vti_generator property key contains "Microsoft Word".

Read-only
vti_scriptlanguage Indicates which scripting language is enabled on the server. Read-only
vti_secureserverurl Retrieves the https:// URL (secured URL) for a Web site. Provides a secure environment for confidential transactions over the Internet. Read-only
vti_serveripaddress The IP address of the server.

Note

An IP address beginning with 127 represents a local server.

Read-only
vti_serverlanguage The language of the operating system. Used for localization purposes. Read-only
vti_showhiddenpages True if hidden pages are displayed. Read-only
vti_sourcecontrolcheckedoutby Authenticated name of the author who last checked out a page. Read-only
vti_sourcecontrolerror The error last returned by the source control system. This error is added to the META tag information if an error occurs while the file is being added to a source control project. Read-only
vti_sourcecontrolproject The name of the source control project. For a Microsoft Visual SourceSafe project, the string includes the "$" symbol, as in "$/myProject" Read-only
vti_sourcecontrolsystem The type of source control in use on the Web site. Can be Microsoft Visual SourceSafe or Microsoft FrontPage Light Weight source control. Valid values for these two types of source control are "VSS" and "LW", respectively. This property key is set when a source control project is started. For more information on source control projects, see Managing Source Control Projects. Read-only
vti_sourcecontrolversion A numbered string that contains the version of the source control system that is in use. Read-only
vti_textextensions A concatenated string of extensions that are commonly used to denote text files. For example, the concatenated string might contain ".txt.rpt..." Read-only
vti_themedefault The default theme of the Web site. Read-only
vti_themesusecss True if CSS is used to present the theme. Read/write
vti_timecreated The timestamp when the page was created. The timestamp is in Coordinated Universal Time (UTC; also known as Greenwich time). Read-only
vti_timelastmodified The time that the page was last modified. The timestamp is in UTC. This is set only when the author edits the page directly. Read-only
vti_timelastwritten The time that the page was last rewritten. The timestamp is in UTC. Read-only
vti_-title The value of the text between the <TITLE> tags on the page. Read-only
vti_usernames The list of known user names for a specified Web site. Read-only
vti_webservertype The type of Web site server. Valid values include "MSIIS" for Microsoft Internet Information Services and "PWS" for Personal Web Server. Read-only
vti_welcomenames A concatenated list of file names that can be used as the file name for the home page, such as "index.htm index.html default.htm". Read-only

See Also