While overriding methods, I came across, "NewItem" function that I had
to override(with the following C# method signature):
----------------------------------------
protected override void NewItem(string path, string itemTypeName,
object newItemValue)
----------------------------------------
Now, what I would like to accomplish is, I would like to have
"New-Item" to have more parameters inside the PsProvider I am writing.
How can I specify addiation provider-specific parameters?
For ex) within "Certificate" PsProvider, "Get-ChildItem" has
"-CodeSigningCert" parameter. I am wondering how it can be done.
By the way, "NewItem" is just one of the functions I would like to add
more parameters to.
Thank you in advance.
protected override object NewItemDynamicParameters(string path,
string type, object newItemValue)
Refer to the PowerShell Managed Reference in the Windows SDK for
documentation on the same
--
Narayanan Lakshmanan [MSFT]
Windows PowerShell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sung M Kim" <DontBother...@gmail.com> wrote in message
news:1160346169.2...@h48g2000cwc.googlegroups.com...
protected override object GetItemDynamicParameters(string path)
{
WriteVerbose("GetItemDynamicParameters:path = " + path);
RuntimeDefinedParameterDictionary dic =
new RuntimeDefinedParameterDictionary();
ParameterAttribute attrib = new ParameterAttribute();
attrib.ParameterSetName = "Path";
attrib.Mandatory = false;
attrib.ValueFromPipeline = true;
Collection<Attribute> col =
new Collection<Attribute>();
col.Add(attrib);
RuntimeDefinedParameter eventIdParam =
new RuntimeDefinedParameter("EventID", typeof(int) ,
col);
dic.Add("EventID", eventIdParam);
return dic;
}
Now the problem is that, I am not sure how I can access the argument
passed to "EventID" parameter inside overriden "GetItem" method. Is
there a utility method that can be used to access the argument for the
dynamic parameter?
Lee
"Sung M Kim" <DontBother...@gmail.com> wrote in message
news:1160447650.7...@m73g2000cwd.googlegroups.com...
Not being able to navigate around(using tree views on MSDN) PowerShell
classes made it a bit harder for me to browse around...
Thank you for the tips there Lee.
By the way, when will System.Management.Automation.* classes for
PowerShell be available on MSDN?
(We of course continue to add and improve them, but they exist.)
--
Lee Holmes [MSFT]
Windows PowerShell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sung M Kim" <DontBother...@gmail.com> wrote in message
news:1160607562.8...@e3g2000cwe.googlegroups.com...