Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. string[] to Microsoft.Exchange.Data.MultiValuedProperty

string[] to Microsoft.Exchange.Data.MultiValuedProperty

Scheduled Pinned Locked Moved C#
toolshelpwindows-admindata-structurestesting
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JD86
    wrote on last edited by
    #1

    I'm working on writing something that will allow you to create distribution groups in Exchange 2010. The problem I am having is I am passing string arrays to my service for the Members and ManagedBy parameters. This is how I attempted to make this work:

    var members = new MultiValuedProperty<object>();
    foreach (string s in group.Members)
    members.Add(s);

    cmd.AddParameter("Members", members);

    The problem I'm having is it is returning an error because it appears it wants Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter within the MultiValuedProperty. I'm a little confused because it then looks like the RecipientWithAdUserGroupIdParameter contains an array of RecipientIdParameter:

    Error: System.ServiceModel.FaultException: System.Management.Automation.RemoteException: Cannot process argument transformation on parameter 'Members'. Cannot convert value "8caf8910-86d0-4d00-a452-8c30c0f62373 cfa01a55-6b35-4e61-bf0e-9050308623c7" to type "Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]]". Error: "Cannot convert the "8caf8910-86d0-4d00-a452-8c30c0f62373" value of type "Deserialized.Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter" to type "Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]"." at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke() at CloudPanel.Exchange.ExchPs.RunPowershell(PSCommand pscmd, String script) at CloudPanel.Exchange.ExchPs.RunPowershell(PSCommand pscmd, String script) at CloudPanel.Exchange.ExchPs.New_DistributionGroup(DistributionGroup group, String companydn)

    Anyone have an idea what I can do to accomplish this? There are some stuff out on the web about using ICollection when reading from Exchange but i'm trying to send commands to exchange.

    J 1 Reply Last reply
    0
    • J JD86

      I'm working on writing something that will allow you to create distribution groups in Exchange 2010. The problem I am having is I am passing string arrays to my service for the Members and ManagedBy parameters. This is how I attempted to make this work:

      var members = new MultiValuedProperty<object>();
      foreach (string s in group.Members)
      members.Add(s);

      cmd.AddParameter("Members", members);

      The problem I'm having is it is returning an error because it appears it wants Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter within the MultiValuedProperty. I'm a little confused because it then looks like the RecipientWithAdUserGroupIdParameter contains an array of RecipientIdParameter:

      Error: System.ServiceModel.FaultException: System.Management.Automation.RemoteException: Cannot process argument transformation on parameter 'Members'. Cannot convert value "8caf8910-86d0-4d00-a452-8c30c0f62373 cfa01a55-6b35-4e61-bf0e-9050308623c7" to type "Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]]". Error: "Cannot convert the "8caf8910-86d0-4d00-a452-8c30c0f62373" value of type "Deserialized.Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter" to type "Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]"." at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke() at CloudPanel.Exchange.ExchPs.RunPowershell(PSCommand pscmd, String script) at CloudPanel.Exchange.ExchPs.RunPowershell(PSCommand pscmd, String script) at CloudPanel.Exchange.ExchPs.New_DistributionGroup(DistributionGroup group, String companydn)

      Anyone have an idea what I can do to accomplish this? There are some stuff out on the web about using ICollection when reading from Exchange but i'm trying to send commands to exchange.

      J Offline
      J Offline
      Jibesh
      wrote on last edited by
      #2

      RecipientIdParameter is the baseclass for RecipientWithAdUserGroupIdParameter so I think by passing the RecipientWithAdUserGroupIdParameter with the MultiValuedProperty might solve this error. Note:I havent used this before.

      Jibesh V P

      J 1 Reply Last reply
      0
      • J Jibesh

        RecipientIdParameter is the baseclass for RecipientWithAdUserGroupIdParameter so I think by passing the RecipientWithAdUserGroupIdParameter with the MultiValuedProperty might solve this error. Note:I havent used this before.

        Jibesh V P

        J Offline
        J Offline
        JD86
        wrote on last edited by
        #3

        The problem is RecipientWithAdUserGroupIdParameter is another array. so it has to be done like this:

        var members = new MultiValuedProperty>();

        But then I can't add to the RecipientWithAdUserGroupIdParameter because it doesn't have that method.

        new RecipientWithAdUserGroupIdParameter().

        Only has these methods: Equals GetHashCode GetObjects<> GetType ToString

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups