Partilhar via


HtmlValidationContext.GuidOfThisSiteCollection Property

Gets or sets the GUID of the current site collection.

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

Syntax

'Declaration
Public Property GuidOfThisSiteCollection As Guid
    Get
    Set
'Usage
Dim instance As HtmlValidationContext
Dim value As Guid

value = instance.GuidOfThisSiteCollection

instance.GuidOfThisSiteCollection = value
public Guid GuidOfThisSiteCollection { get; set; }

Property Value

Type: System.Guid
GUID that contains the identifier of the current site collection.

Remarks

If you want to restrict URLs to a specific site collection, you must set this property to its GUID. This property is only used if RestrictUrlsToSiteCollection is set to True.

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

RestrictUrlsToSiteCollection