Note that there are some explanatory texts on larger screens.

plurals
  1. PORunspace pipeline.invoke within a loop
    text
    copied!<p>I am making an application to collect a lot of exchange data and putting this into a nice interface. so far its working well, however I am running into an issue and I cannot figure it out. I am suspecting it has something to do with the fact that I try to invoke a pipeline within a loop. This is the error I am getting:</p> <blockquote> <p>A positional parameter cannot be found that accepts argument 'Items'.</p> </blockquote> <p>and this is my code:</p> <pre><code>List&lt;Collections.UserMailbox.Accessrights&gt; items = new List&lt;Collections.UserMailbox.Accessrights&gt;(); foreach (string folder in folders) { Pipeline pipe2 = runspace.CreatePipeline(); pipe2.Commands.Add(new Command("Get-MailboxFolderPermission " + primarysmtpaddress + @":\" + folder ,true")); foreach (PSObject psobj in pipe2.Invoke()) { if (!psobj.Properties["AccessRights"].Value.ToString().Equals("None")) { Collections.UserMailbox.AccessRights item = new Collections.UserMailbox.AccessRights(); item.AccessRight = psobj.Properties["AccessRights"].Value.ToString(); item.foldername = psobj.Properties["FolderName"].Value.ToString(); item.user = psobj.Properties["User"].Value.ToString(); items.Add(item); } } pipe2.Dispose(); } public class Collections { public class UserMailbox { public class AccessRights { public string accright { get; set; } public string foldername { get; set; } public string user { get; set; } } } } </code></pre> <p>It errors on the pipe2.invoke() with the error I mentioned above. A previously opened Pipeline I has disposed already.</p> <p>I hope someone has a solution for me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload