Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ public class GetChildItemCommand : CoreCommandBase
private const string childrenSet = "Items";
private const string literalChildrenSet = "LiteralItems";

#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release

/// <summary>
/// The string declaration for the -relationship parameter set.
/// </summary>
///
/// <remarks>
/// The "relationship" parameter set includes the following parameters:
/// -relationship
/// -property
/// </remarks>
///
private const string relationshipSet = "Relationship";
#endif
#region Command parameters

/// <summary>
Expand Down Expand Up @@ -214,51 +199,6 @@ public SwitchParameter Name
}
}

#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release

/// <summary>
/// Gets and sets the value of the Relationship parameter which determines
/// which relationship the targets should be retrieved for.
/// </summary>
///
[Parameter(
Mandatory = true,
ParameterSetName = relationshipSet,
ValueFromPipelineByPropertyName = true)]
public string[] Relationship
{
get
{
return relationships;
}
set
{
relationships = value;
}
}
private string[] relationships = new string[0];

/// <summary>
/// Gets or sets the property parameter which may provide guidance to the relationship
/// provider on which targets to return.
/// </summary>
///
[Parameter(ParameterSetName = relationshipSet, ValueFromPipelineByPropertyName = true)]
public string Property
{
get
{
return property;
}

set
{
property = value;
}
}
private string property = String.Empty;
#endif
/// <summary>
/// A virtual method for retrieving the dynamic parameters for a cmdlet. Derived cmdlets
/// that require dynamic parameters should override this method and return the
Expand Down Expand Up @@ -302,13 +242,6 @@ internal override object GetDynamicParameters(CmdletProviderContext context)
}
break;

#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release

case relationshipSet:
// No possible dynamic parameters for the relationship set.
break;
#endif
default:
result = InvokeProvider.ChildItem.GetChildItemsDynamicParameters(path, Recurse, context);
break;
Expand Down Expand Up @@ -421,63 +354,6 @@ protected override void ProcessRecord()

break;

#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release

case relationshipSet:
foreach (string relationship in relationships)
{
Collection<string> results = null;

try
{
results =
InvokeProvider.Relationship.GetTargets(
relationship,
path,
property);
}
catch (PSArgumentException argException)
{
WriteError(
new ErrorRecord(
argException.ErrorRecord,
argException));
continue;
}
catch (ProviderNotFoundException providerNotFound)
{
WriteError(
new ErrorRecord(
providerNotFound.ErrorRecord,
providerNotFound));
continue;
}

foreach (string target in results)
{
// Create an PSObject with the result.
// Attach the relationship name as a note,
// and set "System.Management.Automation.RelationshipTarget"
// as the TreatAs.

PSObject result = PSObject.AsPSObject (target);
result.Properties.Add (
new PSNoteProperty (
"Relationship",
relationship));

Collection<string> treatAs = new Collection<string> ();
treatAs.Add (targetTreatAsType);

result.TypeNames = treatAs;

// Now write out the result
WriteObject (result);
}
}
break;
#endif
default:
Dbg.Diagnostics.Assert(
false,
Expand All @@ -487,11 +363,6 @@ protected override void ProcessRecord()
}
} // ProcessRecord

#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release

private const string targetTreatAsType = "System.Management.Automation.RelationshipTarget";
#endif
#endregion command code
} // class GetChildrenCommand
} // namespace Microsoft.PowerShell.Commands
Expand Down
Loading