SimpleDelegatedModuleProvider.SetChildDelegationState Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the specified delegation state for all child configurations in the specified path.
public:
override void SetChildDelegationState(System::String ^ path, Microsoft::Web::Management::Server::DelegationState ^ state);
public override void SetChildDelegationState (string path, Microsoft.Web.Management.Server.DelegationState state);
override this.SetChildDelegationState : string * Microsoft.Web.Management.Server.DelegationState -> unit
Public Overrides Sub SetChildDelegationState (path As String, state As DelegationState)
Parameters
- path
- String
The path of the calling host.
- state
- DelegationState
The DelegationState object to set.
Exceptions
path
is null
or empty.
path
contains the "/" character.
Examples
The following example overrides this method and duplicates the base class code.
public override void SetChildDelegationState(string path,
DelegationState state) {
if (String.IsNullOrEmpty(path)) {
throw new ArgumentNullException("path");
}
if (path.IndexOf('/') != -1) {
throw new InvalidOperationException(
"Cannot retrieve the delegation state " +
"for paths that contain '/'.");
}
AdministrationModule currentModule =
ManagementUnit.Administration.Modules[Name];
// Get the management administration configuration
// for the delegated path.
ManagementAdministrationConfiguration
delegatedAdministration =
ManagementUnit.Administration.GetDelegatedScope(path);
AdministrationModuleCollection delegatedModules
= delegatedAdministration.Modules;
if ((state == ParentDelgateState) ||
(state == ReadWriteDelegationState) ||
(state == ReadOnlyDelegationState)) {
delegatedModules.Add(currentModule.Name);
} else if (state == NoneDelegationState) {
if (currentModule != null) {
delegatedModules.Remove(currentModule.Name);
}
}
}