IWMSOnDemandPublishingPoint.AllowContentCaching (C#)

banner art

Previous Next

IWMSOnDemandPublishingPoint.AllowContentCaching (C#)

The AllowContentCaching property specifies and retrieves a Boolean value indicating whether content from the publishing point can be cached.

Syntax

  IWMSOnDemandPublishingPoint
  .AllowContentCaching = bool;
bool = IWMSOnDemandPublishingPoint.AllowContentCaching;

Property Value

A bool indicating whether content can be cached.

If this property fails, it throws an exception.

Number Description
0x80070057 Indicates that newVal is an invalid argument.
0xC00D145AL The publishing point has already been removed.

Remarks

By default, the property defaults to true.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer                    Server;
IWMSPublishingPoints         PubPoints;
IWMSPublishingPoint          PubPoint;
IWMSOnDemandPublishingPoint  ODPubPoint;

bool                         bVal;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSPublishingPoints object.
    PubPoints = Server.PublishingPoints;

    // Retrieve each publishing point and retrieve the
    // IWMSOnDemandPublishingPoint object.
    for (int i = 0; i < PubPoints.Count; i++)
    {
        PubPoint = PubPoints[i];
        if (PubPoint.Type ==  
            WMS_PUBLISHING_POINT_TYPE.WMS_PUBLISHING_POINT_TYPE_ON_DEMAND)
        {
            ODPubPoint = (IWMSOnDemandPublishingPoint)PubPoint;

            // Retrieve a Boolean value indicating whether the
            // client is allowed to cache content.
            bVal = ODPubPoint.AllowContentCaching;

            // Set a Boolean value indicating that the
            // client is allowed to cache content.
            ODPubPoint.AllowContentCaching = true;
            break;
        }
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next