Share via


HtmlValidationContext.RestrictUrlsToSiteCollection property

Gets or sets the constraint that forces all URLs to point to the current site collection.

Namespace:  Microsoft.SharePoint.Publishing.Fields
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
Public Property RestrictUrlsToSiteCollection As Boolean
    Get
    Set
'Usage
Dim instance As HtmlValidationContext
Dim value As Boolean

value = instance.RestrictUrlsToSiteCollection

instance.RestrictUrlsToSiteCollection = value
public bool RestrictUrlsToSiteCollection { get; set; }

Property value

Type: System.Boolean
A Boolean value that indicates whether to force all URLs to point to the current site collection.

Remarks

When set to True, only URLs that point to files in a specific site collection are allowed. You should set the GuidOfThisSiteCollection to the GUID of the site collection.

Examples

      if (null == siteCollectionToRestrict)
      {
          // No site collection provided so do not restrict URLs
          validationContext.RestrictUrlsToSiteCollection = false;
          validationContext.GuidOfThisSiteCollection = System.Guid.Empty;
      }

Note

This example is part of the larger ValidateHtmlCode sample in the HtmlValidationContext topic.

See also

Reference

HtmlValidationContext class

HtmlValidationContext members

Microsoft.SharePoint.Publishing.Fields namespace

GuidOfThisSiteCollection